From afc3f9cb24d1e0ee01dc5841fa4c215e697548de Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 1 Jul 2014 12:25:38 +0200 Subject: [PATCH] base-filesystem: avoid all searching if the link already exists --- src/shared/base-filesystem.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/shared/base-filesystem.c b/src/shared/base-filesystem.c index f68386b8e..daaeaca51 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) -- 2.30.2