base-filesystem: avoid all searching if the link already exists
This commit is contained in:
parent
3fd165e53a
commit
afc3f9cb24
|
@ -65,6 +65,9 @@ int base_filesystem_create(const char *root) {
|
||||||
const char *target = NULL;
|
const char *target = NULL;
|
||||||
const char *s;
|
const char *s;
|
||||||
|
|
||||||
|
if (faccessat(fd, table[i].dir, F_OK, AT_SYMLINK_NOFOLLOW) >= 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
/* check if one of the targets exists */
|
/* check if one of the targets exists */
|
||||||
NULSTR_FOREACH(s, table[i].target) {
|
NULSTR_FOREACH(s, table[i].target) {
|
||||||
if (faccessat(fd, s, F_OK, AT_SYMLINK_NOFOLLOW) < 0)
|
if (faccessat(fd, s, F_OK, AT_SYMLINK_NOFOLLOW) < 0)
|
||||||
|
|
Loading…
Reference in New Issue