udevadm trigger: do not propagate EACCES and ENODEV

Inside container, writing file returns EACCESS. Moreover, some devices
return ENODEV rather than EACCES. So, let's also ignore these two
error causes.

Closes #13652.
This commit is contained in:
Yu Watanabe
2019-09-26 21:33:59 +09:00
committed by Zbigniew Jędrzejewski-Szmek
parent 065a74a7d8
commit 67acde4869

View File

@@ -45,9 +45,11 @@ static int exec_list(sd_device_enumerator *e, const char *action, Set *settle_se
r = write_string_file(filename, action, WRITE_STRING_FILE_DISABLE_BUFFER);
if (r < 0) {
log_full_errno(r == -ENOENT ? LOG_DEBUG : LOG_ERR, r,
bool ignore = IN_SET(r, -ENOENT, -EACCES, -ENODEV);
log_full_errno(ignore ? LOG_DEBUG : LOG_ERR, r,
"Failed to write '%s' to '%s': %m", action, filename);
if (ret == 0 && r != -ENOENT)
if (ret == 0 && !ignore)
ret = r;
continue;
}