diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-09-29 06:44:28 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2020-09-29 21:44:10 +0200 |
commit | 88da55e28b467999da005591d3252a98f4436522 (patch) | |
tree | 17fcfa89cc6896514521611a663cccaa282ee6cf /src/udev/udevadm-trigger.c | |
parent | Merge pull request #17194 from poettering/dot-suffix (diff) | |
download | systemd-88da55e28b467999da005591d3252a98f4436522.tar.xz systemd-88da55e28b467999da005591d3252a98f4436522.zip |
udevadm: do not ignroe error caused by unpriviledged user invoking the command
This effectively reverts commit 67acde4869a9505f9721e31fa5167c82445e0e12.
After commits 569ad251adde02dc0915758fe027e0346e50738a and
67acde4869a9505f9721e31fa5167c82445e0e12, -EACCES errors are ignored,
and thus 'udevadm trigger' succeeds even when it is invoked by non-root
users. Moreover, on -EACCES error, log messages are shown in debug
level, so usually we see no message, and users are easily confused
why uevents for devices are not triggered.
Diffstat (limited to '')
-rw-r--r-- | src/udev/udevadm-trigger.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/udev/udevadm-trigger.c b/src/udev/udevadm-trigger.c index 39113d2fa2..0da4ea787b 100644 --- a/src/udev/udevadm-trigger.c +++ b/src/udev/udevadm-trigger.c @@ -45,13 +45,14 @@ static int exec_list(sd_device_enumerator *e, const char *action, Set **settle_s r = write_string_file(filename, action, WRITE_STRING_FILE_DISABLE_BUFFER); if (r < 0) { - bool ignore = IN_SET(r, -ENOENT, -EACCES, -ENODEV, -EROFS); + bool ignore = r == -ENOENT; log_full_errno(ignore ? LOG_DEBUG : LOG_ERR, r, "Failed to write '%s' to '%s'%s: %m", action, filename, ignore ? ", ignoring" : ""); - if (r == -EROFS) - return 0; /* Read only filesystem. Return earlier. */ + if (IN_SET(r, -EACCES, -ENODEV, -EROFS)) + /* Inovoked by unpriviledged user, or read only filesystem. Return earlier. */ + return r; if (ret == 0 && !ignore) ret = r; continue; |