minor fixes

This commit is contained in:
illiliti
2020-07-25 17:42:47 +03:00
parent d05676f232
commit 984295b4a0

View File

@@ -430,11 +430,11 @@ struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *
return NULL;
}
if (!realpath(syspath, path)) {
if (stat(syspath, &st) != 0 || !S_ISDIR(st.st_mode)) {
return NULL;
}
if (stat(path, &st) != 0 || S_ISDIR(st.st_mode) == 0) {
if (!realpath(syspath, path)) {
return NULL;
}