mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-10-27 18:55:09 +03:00
udevadm: do not ignroe error caused by unpriviledged user invoking the command
This effectively reverts commit67acde4869
. After commits569ad251ad
and67acde4869
, -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.
This commit is contained in:
parent
a182fa895b
commit
88da55e28b
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user