base-filesystem: avoid all searching if the link already exists

This commit is contained in:
Kay Sievers 2014-07-01 12:25:38 +02:00
parent 3fd165e53a
commit afc3f9cb24
1 changed files with 3 additions and 0 deletions

View 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)