From 4e32e8907df5259bc39f23b5e350e14a362ec4b0 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Thu, 25 Jul 2019 17:56:30 +0200 Subject: [PATCH] main: fix fd validity check Signed-off-by: Giuseppe Scrivano --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 58ffe43..a3c9771 100644 --- a/main.c +++ b/main.c @@ -2858,7 +2858,7 @@ create_file (struct ovl_data *lo, int dirfd, const char *path, uid_t uid, gid_t if (uid == lo->uid && gid == lo->gid) { ret = TEMP_FAILURE_RETRY (openat (get_upper_layer (lo)->fd, path, flags, mode)); - if (ret == 0) + if (ret >= 0) return ret; /* if it fails (e.g. there is a whiteout) then fallback to create it in the working dir + rename. */