libudev-util.c: get_sys_link() - return error for empty link target

This commit is contained in:
Kay Sievers 2009-09-01 12:39:57 +02:00
parent 32ecabb15d
commit 0652604912

View File

@ -31,7 +31,7 @@ static ssize_t get_sys_link(struct udev *udev, const char *slink, const char *sy
util_strscpyl(path, sizeof(path), syspath, "/", slink, NULL);
len = readlink(path, path, sizeof(path));
if (len < 0 || len >= (ssize_t) sizeof(path))
if (len <= 0 || len == (ssize_t)sizeof(path))
return -1;
path[len] = '\0';
pos = strrchr(path, '/');