sd-device: make FOREACH_DEVICE_SYSATTR() also list write-only attributes
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 13 Dec 2021 21:24:24 +0000 (06:24 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 14 Dec 2021 12:49:56 +0000 (21:49 +0900)
Closes #10102.

src/libsystemd/sd-device/sd-device.c

index e594d5fbe4e1babe38f079fe38dfdd986d591612..8b6e1ddd699dab8ef9782db1e0f39b77e8b908e3 100644 (file)
@@ -1812,7 +1812,7 @@ static int device_sysattrs_read_all_internal(sd_device *device, const char *subd
                 if (lstat(path, &statbuf) != 0)
                         continue;
 
-                if (!(statbuf.st_mode & S_IRUSR))
+                if ((statbuf.st_mode & (S_IRUSR | S_IWUSR)) == 0)
                         continue;
 
                 r = set_put_strdup(&device->sysattrs, p ?: dent->d_name);