diff --git a/cmdline/elem.c b/cmdline/elem.c index 60c63a9e..2356aad6 100644 --- a/cmdline/elem.c +++ b/cmdline/elem.c @@ -375,7 +375,7 @@ int filter_existence(int filter_missing, const char* dir, const char* sub) if (lstat(path, &st) != 0) { /* if the file doesn't exist, we don't filter it out */ - if (errno == ENOENT) + if (errno == ENOENT || errno == ENOTDIR) return 0; /* LCOV_EXCL_START */ log_fatal(errno, "Error in stat file '%s'. %s.\n", path, strerror(errno)); diff --git a/cmdline/handle.c b/cmdline/handle.c index 11522209..34660054 100644 --- a/cmdline/handle.c +++ b/cmdline/handle.c @@ -113,7 +113,7 @@ int handle_open_create(struct snapraid_handle* handle, struct snapraid_file* fil * If creation was not requested, a missing file is an expected condition, * not a fatal error. */ - if (create || errno != ENOENT) { + if (create || (errno != ENOENT && errno != ENOTDIR)) { /* LCOV_EXCL_START */ log_fatal(errno, "Error opening file '%s'. %s.\n", handle->path, strerror(errno)); /* LCOV_EXCL_STOP */