libudev: set errno properly in all error conditions of udev_device_new_from_syspath()

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
This commit is contained in:
Lennart Poettering 2014-12-03 01:59:42 +01:00 committed by Anthony G. Basile
parent f8dfb6283d
commit 1914270962

View File

@ -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);