summaryrefslogtreecommitdiffstats
path: root/src/udev
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-02-22 18:17:08 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-02-22 19:21:32 +0100
commit916a8d4341cc2d188614fee011346f2df8daf86c (patch)
treefc7b93eaa663d31d1fb823842183858d449bcad9 /src/udev
parentudev-test.pl: add --strace option (diff)
downloadsystemd-916a8d4341cc2d188614fee011346f2df8daf86c.tar.xz
systemd-916a8d4341cc2d188614fee011346f2df8daf86c.zip
udev-rules: fix querying of attributes
faccessat returns 0 on success. A cosmetic fix is also included: the slash was doubled unnecessarily.
Diffstat (limited to 'src/udev')
-rw-r--r--src/udev/udev-rules.c6
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;
}