mirror of
https://github.com/systemd/systemd
synced 2026-04-10 17:15:03 +02:00
Compare commits
3 Commits
d4453d5ee8
...
05c1b1c95e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
05c1b1c95e | ||
|
|
3a90bef55a | ||
|
|
ab218d0bdb |
@ -1812,7 +1812,7 @@ static int device_sysattrs_read_all_internal(sd_device *device, const char *subd
|
|||||||
if (lstat(path, &statbuf) != 0)
|
if (lstat(path, &statbuf) != 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!(statbuf.st_mode & S_IRUSR))
|
if ((statbuf.st_mode & (S_IRUSR | S_IWUSR)) == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
r = set_put_strdup(&device->sysattrs, p ?: dent->d_name);
|
r = set_put_strdup(&device->sysattrs, p ?: dent->d_name);
|
||||||
|
|||||||
@ -73,6 +73,7 @@ static int print_all_attributes(sd_device *device, bool is_parent) {
|
|||||||
_cleanup_free_ SysAttr *sysattrs = NULL;
|
_cleanup_free_ SysAttr *sysattrs = NULL;
|
||||||
const char *name, *value;
|
const char *name, *value;
|
||||||
size_t n_items = 0;
|
size_t n_items = 0;
|
||||||
|
int r;
|
||||||
|
|
||||||
value = NULL;
|
value = NULL;
|
||||||
(void) sd_device_get_devpath(device, &value);
|
(void) sd_device_get_devpath(device, &value);
|
||||||
@ -96,18 +97,22 @@ static int print_all_attributes(sd_device *device, bool is_parent) {
|
|||||||
if (skip_attribute(name))
|
if (skip_attribute(name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (sd_device_get_sysattr_value(device, name, &value) < 0)
|
r = sd_device_get_sysattr_value(device, name, &value);
|
||||||
continue;
|
if (r >= 0) {
|
||||||
|
/* skip any values that look like a path */
|
||||||
|
if (value[0] == '/')
|
||||||
|
continue;
|
||||||
|
|
||||||
/* skip any values that look like a path */
|
/* skip nonprintable attributes */
|
||||||
if (value[0] == '/')
|
len = strlen(value);
|
||||||
continue;
|
while (len > 0 && isprint((unsigned char) value[len-1]))
|
||||||
|
len--;
|
||||||
|
if (len > 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
/* skip nonprintable attributes */
|
} else if (r == -EPERM)
|
||||||
len = strlen(value);
|
value = "(write-only)";
|
||||||
while (len > 0 && isprint((unsigned char) value[len-1]))
|
else
|
||||||
len--;
|
|
||||||
if (len > 0)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!GREEDY_REALLOC(sysattrs, n_items + 1))
|
if (!GREEDY_REALLOC(sysattrs, n_items + 1))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user