summaryrefslogtreecommitdiff
path: root/src/libudev
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-12-03 01:59:42 +0100
committerLennart Poettering <lennart@poettering.net>2014-12-03 02:04:55 +0100
commit154e6f233af028cf76608d49a3b7ed8de61373d8 (patch)
tree90b6436119d0f3ba402ab883a19beb4aece96711 /src/libudev
parent45548321d647b9747e8abc69b5cd8d237244c880 (diff)
libudev: set errno properly in all error conditions of udev_device_new_from_syspath()
Diffstat (limited to 'src/libudev')
-rw-r--r--src/libudev/libudev-device.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libudev/libudev-device.c b/src/libudev/libudev-device.c
index 5f196bd9b8..16ee1f4be3 100644
--- a/src/libudev/libudev-device.c
+++ b/src/libudev/libudev-device.c
@@ -723,8 +723,13 @@ _public_ struct udev_device *udev_device_new_from_syspath(struct udev *udev, con
return NULL;
} else {
/* everything else just needs to be a directory */
- if (stat(path, &statbuf) != 0 || !S_ISDIR(statbuf.st_mode))
+ if (stat(path, &statbuf) != 0)
return NULL;
+
+ if (!S_ISDIR(statbuf.st_mode)) {
+ errno = EISDIR;
+ return NULL;
+ }
}
udev_device = udev_device_new(udev);