]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udevadm trigger: do not propagate EACCES and ENODEV
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 26 Sep 2019 12:33:59 +0000 (21:33 +0900)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 2 Oct 2019 12:23:44 +0000 (14:23 +0200)
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.

src/udev/udevadm-trigger.c

index 77d95e513fb3ae4ddef8ecefcd2494b237bb6e9f..11f2f1c98515d1c813ef923f595b0e8108dbe483 100644 (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;
                 }