From: Lennart Poettering Date: Wed, 2 Feb 2022 14:20:30 +0000 (+0100) Subject: udevadm: don't claim a sysattr was write only just because we get EPERM on read X-Git-Tag: v251-rc1~369 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a24e3938e8611146595bd2302cc7d47666132ba2;p=thirdparty%2Fsystemd.git udevadm: don't claim a sysattr was write only just because we get EPERM on read 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 --- diff --git a/src/udev/udevadm-info.c b/src/udev/udevadm-info.c index 5ae33e101ae..992764b80ce 100644 --- a/src/udev/udevadm-info.c +++ b/src/udev/udevadm-info.c @@ -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;