From: Vincent Bernat Date: Mon, 13 Sep 2021 06:19:49 +0000 (+0200) Subject: priv: fix chroot creation X-Git-Tag: 1.0.13~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4ed0cd5ceab3258a2b5b66a877f1bb40fd94a022;p=thirdparty%2Flldpd.git priv: fix chroot creation --- 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;