sd-device: use ERRNO_IS_DEVICE_ABSENT() at one more place
This commit is contained in:
@@ -835,10 +835,9 @@ int device_shallow_clone(sd_device *old_device, sd_device **new_device) {
|
||||
return r;
|
||||
}
|
||||
|
||||
/* And then read uevent file, but ignore errors, as some devices seem to return a spurious
|
||||
* error on read, e.g. -ENODEV, and even if ifindex or devnum is set in the above,
|
||||
* sd_device_get_ifindex() or sd_device_get_devnum() fails. See. #19788. */
|
||||
(void) device_read_uevent_file(ret);
|
||||
r = device_read_uevent_file(ret);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
*new_device = TAKE_PTR(ret);
|
||||
return 0;
|
||||
|
||||
@@ -724,11 +724,14 @@ int device_read_uevent_file(sd_device *device) {
|
||||
path = strjoina(syspath, "/uevent");
|
||||
|
||||
r = read_full_virtual_file(path, &uevent, &uevent_len);
|
||||
if (IN_SET(r, -EACCES, -ENOENT))
|
||||
/* The uevent files may be write-only, or the device may not have uevent file. */
|
||||
return 0;
|
||||
if (r < 0)
|
||||
if (r < 0) {
|
||||
/* The uevent files may be write-only, the device may be already removed, or the device
|
||||
* may not have the uevent file. */
|
||||
if (r == -EACCES || ERRNO_IS_DEVICE_ABSENT(r))
|
||||
return 0;
|
||||
|
||||
return log_device_debug_errno(device, r, "sd-device: Failed to read uevent file '%s': %m", path);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < uevent_len; i++)
|
||||
switch (state) {
|
||||
|
||||
Reference in New Issue
Block a user