summaryrefslogtreecommitdiff
path: root/udev/lib/libudev-util.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2008-09-21 23:28:56 -0700
committerKay Sievers <kay.sievers@vrfy.org>2008-09-21 23:28:56 -0700
commit4c9dff47f696b1e6c89cc6e0a7ba683067927821 (patch)
treeb2b2c472b551d62cc6bf9132b5d825c5fd490337 /udev/lib/libudev-util.c
parentfb762bb928772f1923fef1e342d8ebca9bf7691f (diff)
libudev: add udev_device_new_from_devnum()
Diffstat (limited to 'udev/lib/libudev-util.c')
-rw-r--r--udev/lib/libudev-util.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/udev/lib/libudev-util.c b/udev/lib/libudev-util.c
index 7eadc7f296..aa544fea22 100644
--- a/udev/lib/libudev-util.c
+++ b/udev/lib/libudev-util.c
@@ -64,12 +64,17 @@ ssize_t util_get_sys_driver(struct udev *udev, const char *syspath, char *driver
int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size)
{
+ struct stat statbuf;
char link_target[UTIL_PATH_SIZE];
int len;
int i;
int back;
+ if (lstat(syspath, &statbuf) < 0)
+ return -1;
+ if (!S_ISLNK(statbuf.st_mode))
+ return -1;
len = readlink(syspath, link_target, sizeof(link_target));
if (len <= 0)
return -1;