]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udevadm: don't claim a sysattr was write only just because we get EPERM on read
authorLennart Poettering <lennart@poettering.net>
Wed, 2 Feb 2022 14:20:30 +0000 (15:20 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 2 Feb 2022 22:32:54 +0000 (07:32 +0900)
it might be totally inaccessible, hence weaken our language a bit and
just say "not readable", thus making not claim whether it is writable or
not.

Follow-up for 3a90bef55a5a71a03629a762470b0f9014cd8453

src/udev/udevadm-info.c

index 5ae33e101ae17d27089028d38edc6f6618a3c30c..992764b80ce64d56c0116cac5777f93f75553ce0 100644 (file)
@@ -16,6 +16,7 @@
 #include "device-private.h"
 #include "device-util.h"
 #include "dirent-util.h"
+#include "errno-util.h"
 #include "fd-util.h"
 #include "sort-util.h"
 #include "static-destruct.h"
@@ -117,8 +118,8 @@ static int print_all_attributes(sd_device *device, bool is_parent) {
                         if (len > 0)
                                 continue;
 
-                } else if (r == -EPERM)
-                        value = "(write-only)";
+                } else if (ERRNO_IS_PRIVILEGE(r))
+                        value = "(not readable)";
                 else
                         continue;