summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2014-07-01 12:25:38 +0200
committerKay Sievers <kay@vrfy.org>2014-07-01 12:25:38 +0200
commitafc3f9cb24d1e0ee01dc5841fa4c215e697548de (patch)
treef8d096b063e0aa8216b9a6bb300f5e192294fedf /src/shared
parent3fd165e53a90dd30af00ec0e963d8e132e3506f9 (diff)
base-filesystem: avoid all searching if the link already exists
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/base-filesystem.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/shared/base-filesystem.c b/src/shared/base-filesystem.c
index f68386b8e3..daaeaca515 100644
--- a/src/shared/base-filesystem.c
+++ b/src/shared/base-filesystem.c
@@ -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)