diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2016-02-22 12:17:08 -0500 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2016-02-22 13:21:32 -0500 |
commit | 916a8d4341cc2d188614fee011346f2df8daf86c (patch) | |
tree | fc7b93eaa663d31d1fb823842183858d449bcad9 | |
parent | 587751eb663c8c52133d9a90a6bc8b7b84bdfcc6 (diff) |
udev-rules: fix querying of attributes
faccessat returns 0 on success.
A cosmetic fix is also included: the slash was doubled unnecessarily.
-rw-r--r-- | src/udev/udev-rules.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index 8470456d4c..475856db6f 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c @@ -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; } |