limit $attr(<symlink>) magic to well-known links only

This commit is contained in:
Kay Sievers
2008-11-17 02:01:37 +01:00
parent 56116314d1
commit 096e59edc9
+6 -1
View File
@@ -859,11 +859,16 @@ const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const
}
if (S_ISLNK(statbuf.st_mode)) {
/* links return the last element of the target path */
char target[UTIL_NAME_SIZE];
int len;
char *pos;
/* some core links return the last element of the target path */
if (strcmp(sysattr, "driver") != 0 &&
strcmp(sysattr, "subsystem") != 0 &&
strcmp(sysattr, "module") != 0)
goto out;
len = readlink(path, target, sizeof(target));
if (len > 0) {
target[len] = '\0';