From: Kay Sievers Date: Tue, 1 Jul 2014 10:25:38 +0000 (+0200) Subject: base-filesystem: avoid all searching if the link already exists X-Git-Tag: v215~71 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=afc3f9cb24d1e0ee01dc5841fa4c215e697548de base-filesystem: avoid all searching if the link already exists --- 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)