From 426f6dc0bcf462b165ff80bcaf966e6a3082433d Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Wed, 30 Sep 2026 16:03:07 +0200 Subject: [PATCH] Treat ENOTDIR as missing file in filter_existence and handle_open_create --- cmdline/elem.c | 2 +- cmdline/handle.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 */