mirror of
https://github.com/troglobit/finit.git
synced 2026-11-13 17:00:16 +00:00
keventd: resolve $attr{} and %s{} through the parent chain
Attribute substitution only looked at the device's own sysfs directory,
while the matching key ATTRS{} walks parents. Devices without an
attribute of their own, partitions in particular whose serial lives in
the parent disk, therefore substituted to an empty string.
This commit is contained in:
3 files changed
+52
-7
No files matched your search
+8
-7
@@ -602,12 +602,12 @@ static void subst_value(const char *src, char *buf, size_t bufsz,
|
||||
|
||||
if (al >= sizeof(attr))
|
||||
al = sizeof(attr) - 1;
|
||||
memcpy(attr, as, al);
|
||||
attr[al] = 0;
|
||||
if (!sysfs_read_attr(ev->devpath, attr,
|
||||
tmp, sizeof(tmp)))
|
||||
append_str(buf, &pos, bufsz, tmp);
|
||||
p = ae + 1;
|
||||
memcpy(attr, as, al);
|
||||
attr[al] = 0;
|
||||
if (!sysfs_read_attr_chain(ev->devpath, attr,
|
||||
tmp, sizeof(tmp)))
|
||||
append_str(buf, &pos, bufsz, tmp);
|
||||
p = ae + 1;
|
||||
} else {
|
||||
buf[pos++] = '%'; buf[pos] = 0;
|
||||
}
|
||||
@@ -681,7 +681,8 @@ static void subst_value(const char *src, char *buf, size_t bufsz,
|
||||
al = sizeof(attr) - 1;
|
||||
memcpy(attr, as, al);
|
||||
attr[al] = 0;
|
||||
if (!sysfs_read_attr(ev->devpath, attr, tmp, sizeof(tmp)))
|
||||
if (!sysfs_read_attr_chain(ev->devpath, attr,
|
||||
tmp, sizeof(tmp)))
|
||||
append_str(buf, &pos, bufsz, tmp);
|
||||
p = ae + 1;
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user