diff --git a/src/shared/base-filesystem.c b/src/shared/base-filesystem.c index addd26ca39..ba8b829ab3 100644 --- a/src/shared/base-filesystem.c +++ b/src/shared/base-filesystem.c @@ -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)