Treat ENOTDIR as missing file in filter_existence and handle_open_create
Some checks are pending
Build / build-mac (push) Waiting to run
Build / build-linux (push) Waiting to run
Build / build-arm32 (push) Waiting to run
Build / build-win (push) Waiting to run
Build / build-freebsd (push) Waiting to run
Build / build-musl (push) Waiting to run
CodeQL Advanced / Analyze (c-cpp) (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run

This commit is contained in:
Andrea Mazzoleni 2026-09-30 16:03:07 +02:00
parent eb75cef0fe
commit 426f6dc0bc
2 changed files with 2 additions and 2 deletions

View file

@ -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));

View file

@ -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 */