chiark / gitweb /
base-filesystem: avoid all searching if the link already exists
authorKay Sievers <kay@vrfy.org>
Tue, 1 Jul 2014 10:25:38 +0000 (12:25 +0200)
committerKay Sievers <kay@vrfy.org>
Tue, 1 Jul 2014 10:25:38 +0000 (12:25 +0200)
src/shared/base-filesystem.c

index f68386b..daaeaca 100644 (file)
@@ -65,6 +65,9 @@ int base_filesystem_create(const char *root) {
                         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)