diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-12-03 01:59:42 +0100 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2014-12-04 16:44:56 -0500 |
commit | 1914270962539e8b9c8881c9b6660af7b9fb0d78 (patch) | |
tree | 5ac610ca2a938262c7df0fa935e6118d7f29846c /src/libudev | |
parent | f8dfb6283d442f3d7c4a42c7d2e929c5c31fd52e (diff) |
libudev: set errno properly in all error conditions of udev_device_new_from_syspath()
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/libudev')
-rw-r--r-- | src/libudev/libudev-device.c | 7 |
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); |