summaryrefslogtreecommitdiff
path: root/src/rfkill
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-04-05 12:43:08 +0200
committerLennart Poettering <lennart@poettering.net>2018-04-05 13:00:43 +0200
commitbc5e002ef1728f45871d2b0344e3f04108db62c7 (patch)
tree73db422c6955672f6fb97f5e3a79e25538da46d5 /src/rfkill
parent3b3d1737be0023791e45dfa357b347c832d2a615 (diff)
downloadsystemd-bc5e002ef1728f45871d2b0344e3f04108db62c7.tar.gz
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
Diffstat (limited to 'src/rfkill')
-rw-r--r--src/rfkill/rfkill.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/rfkill/rfkill.c b/src/rfkill/rfkill.c
index 139b4343b0..4c2ae2b50f 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);