chiark / gitweb /
base_filesystem_create: do not try to create "/root" if it exists
[elogind.git] / src / shared / base-filesystem.c
index addd26ca39d1980b455c328ed27c37c7d16c480a..ba8b829ab3af98ade4553d65e55e6002fb0ad616 100644 (file)
@@ -62,13 +62,13 @@ int base_filesystem_create(const char *root) {
                 return -errno;
 
         for (i = 0; i < ELEMENTSOF(table); i ++) {
+                if (faccessat(fd, table[i].dir, F_OK, AT_SYMLINK_NOFOLLOW) >= 0)
+                        continue;
+
                 if (table[i].target) {
                         const char *target = NULL;
                         const char *s;
 
-                        if (faccessat(fd, table[i].dir, F_OK, AT_SYMLINK_NOFOLLOW) >= 0)
-                                continue;
-
                         /* check if one of the targets exists */
                         NULSTR_FOREACH(s, table[i].target) {
                                 if (faccessat(fd, s, F_OK, AT_SYMLINK_NOFOLLOW) < 0)