]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
priv: fix chroot directory creation
authorVincent Bernat <vincent@bernat.ch>
Fri, 9 Apr 2021 09:51:19 +0000 (11:51 +0200)
committerVincent Bernat <vincent@bernat.ch>
Fri, 9 Apr 2021 09:51:19 +0000 (11:51 +0200)
The last component was not created!

NEWS
src/daemon/priv.c

diff --git a/NEWS b/NEWS
index efcf9fa260152f00fb75faee035eaac1085bb7fe..addd831772ff44bdc0cff4af063d1296ef9fbd17 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+lldpd (1.0.10)
+  * Fix:
+    + Fix chroot directory creation.
+
 lldpd (1.0.9)
   * Fix:
     + Do not use interface alias if we set it ourselves.
index e4ae6eca9de81d34fd4c8c0046afb32c28e33d20..a1a0bf951f92ed2f8af6b8bf1f0e0cefc5aefcb0 100644 (file)
@@ -537,6 +537,8 @@ static int mkdir_p(const char *pathname, mode_t mode)
                        return -1;
                *current = '/';
        }
+       if (mkdir(path, mode) != 0 && errno != EEXIST)
+               return -1;
 
        errno = 0;
        return 0;