From 4ed0cd5ceab3258a2b5b66a877f1bb40fd94a022 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Mon, 13 Sep 2021 08:19:49 +0200 Subject: [PATCH] priv: fix chroot creation --- src/daemon/priv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/daemon/priv.c b/src/daemon/priv.c index 026e32c3..e13604a9 100644 --- a/src/daemon/priv.c +++ b/src/daemon/priv.c @@ -522,10 +522,10 @@ sig_chld(int sig) static int _mkdir(const char *pathname, mode_t mode) { int save_errno; - if (mkdir(pathname, mode) == 0) + if (mkdir(pathname, mode) == 0 || errno == EEXIST) { + errno = 0; return 0; - if (errno == EEXIST) - return -1; + } /* We can get EROFS on some platforms. Let's check if the directory exists. */ save_errno = errno; -- 2.39.5