summaryrefslogtreecommitdiff
path: root/src/libsystemd
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-04-21 14:41:13 +0200
committerTom Gundersen <teg@jklm.no>2015-04-21 14:41:13 +0200
commit52d629010db73a9466c359201916494bd55186d1 (patch)
tree8782c631b30d4a99b5fd474ea868b5920447fd88 /src/libsystemd
parent38422da754ddef86d4db46a5130dcfddb7487de2 (diff)
sd-device: set_syspath - return ENODEV when passed something that is not a device
Diffstat (limited to 'src/libsystemd')
-rw-r--r--src/libsystemd/sd-device/sd-device.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c
index 2e30b85ad2..7a7b323f3c 100644
--- a/src/libsystemd/sd-device/sd-device.c
+++ b/src/libsystemd/sd-device/sd-device.c
@@ -184,15 +184,17 @@ int device_set_syspath(sd_device *device, const char *_syspath, bool verify) {
path = strjoina(syspath, "/uevent");
r = access(path, F_OK);
if (r < 0) {
+ if (errno == ENOENT)
+ /* this is not a valid device */
+ return -ENODEV;
+
log_debug("sd-device: %s does not have an uevent file: %m", syspath);
return -errno;
}
} else {
/* everything else just just needs to be a directory */
- if (!is_dir(syspath, false)) {
- log_debug("sd-device: %s is not a directory", syspath);
- return -EINVAL;
- }
+ if (!is_dir(syspath, false))
+ return -ENODEV;
}
} else {
syspath = strdup(_syspath);