1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-04 13:51:24 +03:00

udev-rules: fix querying of attributes

faccessat returns 0 on success.

A cosmetic fix is also included: the slash was doubled unnecessarily.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2016-02-22 12:17:08 -05:00
parent 587751eb66
commit 916a8d4341

View File

@ -705,10 +705,10 @@ static void attr_subst_subdir(char *attr, size_t len) {
for (dent = readdir(dir); dent != NULL; dent = readdir(dir))
if (dent->d_name[0] != '.') {
char n[strlen(dent->d_name) + 1 + strlen(tail) + 1];
char n[strlen(dent->d_name) + strlen(tail) + 1];
strscpyl(n, sizeof n, dent->d_name, "/", tail, NULL);
if (faccessat(dirfd(dir), n, F_OK, 0)) {
strscpyl(n, sizeof n, dent->d_name, tail, NULL);
if (faccessat(dirfd(dir), n, F_OK, 0) == 0) {
strscpyl(attr, len, path, n, NULL);
break;
}