From: Lennart Poettering Date: Thu, 5 Apr 2018 10:43:08 +0000 (+0200) Subject: rfkill: treat ENXIO/ENODEV the same way as ENOENT X-Git-Tag: v239~434^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bc5e002ef1728f45871d2b0344e3f04108db62c7;p=thirdparty%2Fsystemd.git rfkill: treat ENXIO/ENODEV the same way as ENOENT If an rfkill device disappears between the time we get notified about the existance and we fully opened it we might get ENXIO or ENODEV (i.e. the two kinds of "device not found" errors, which are typically generated when for example a device node has no actual backing device behind it). let's handle that the same way as ENOENT, and downgrade the log message to LOG_DEBUG. Fixes: #8586 --- diff --git a/src/rfkill/rfkill.c b/src/rfkill/rfkill.c index 139b4343b00..4c2ae2b50fd 100644 --- a/src/rfkill/rfkill.c +++ b/src/rfkill/rfkill.c @@ -89,8 +89,8 @@ static int find_device( device = udev_device_new_from_subsystem_sysname(udev, "rfkill", sysname); if (!device) - return log_full_errno(errno == ENOENT ? LOG_DEBUG : LOG_ERR, errno, - "Failed to open device %s: %m", sysname); + return log_full_errno(IN_SET(errno, ENOENT, ENXIO, ENODEV) ? LOG_DEBUG : LOG_ERR, errno, + "Failed to open device '%s': %m", sysname); name = udev_device_get_sysattr_value(device, "name"); if (!name) { @@ -148,8 +148,8 @@ static int wait_for_initialized( /* Check again, maybe things changed */ d = udev_device_new_from_subsystem_sysname(udev, "rfkill", sysname); if (!d) - return log_full_errno(errno == ENOENT ? LOG_DEBUG : LOG_ERR, errno, - "Failed to open device %s: %m", sysname); + return log_full_errno(IN_SET(errno, ENOENT, ENXIO, ENODEV) ? LOG_DEBUG : LOG_ERR, errno, + "Failed to open device '%s': %m", sysname); if (udev_device_get_is_initialized(d) != 0) { *ret = d; @@ -313,6 +313,7 @@ static int save_state_queue( r = determine_state_file(udev, event, &state_file); if (r < 0) return r; + save_state_queue_remove(write_queue, event->idx, state_file); item = new0(struct write_queue_item, 1);