mirror of
https://github.com/systemd/systemd
synced 2026-03-19 19:44:48 +01:00
Compare commits
No commits in common. "9952f11a84b333a36e9f1f4a62b951ab84c897f5" and "d3a047b9d1277c92657ad69e210a60e0dbb2f430" have entirely different histories.
9952f11a84
...
d3a047b9d1
@ -2022,17 +2022,13 @@ _public_ int sd_device_get_sysattr_value(sd_device *device, const char *sysattr,
|
|||||||
/* skip non-readable files */
|
/* skip non-readable files */
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
else {
|
else {
|
||||||
size_t size;
|
/* read attribute value */
|
||||||
|
r = read_full_virtual_file(path, &value, NULL);
|
||||||
/* Read attribute value, Some attributes contain embedded '\0'. So, it is necessary to
|
|
||||||
* also get the size of the result. See issue #20025. */
|
|
||||||
r = read_full_virtual_file(path, &value, &size);
|
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
/* drop trailing newlines */
|
/* drop trailing newlines */
|
||||||
while (size > 0 && strchr(NEWLINE, value[--size]))
|
delete_trailing_chars(value, "\n");
|
||||||
value[size] = '\0';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unfortunately, we need to return 'const char*' instead of 'char*'. Hence, failure in caching
|
/* Unfortunately, we need to return 'const char*' instead of 'char*'. Hence, failure in caching
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user