summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2012-01-21 06:00:17 +0100
committerKay Sievers <kay.sievers@vrfy.org>2012-01-21 06:18:32 +0100
commitd2b795f2b942a2532c396c7e55d6cd8369cae7fc (patch)
tree1724f337cc1503afce0628481ed7b3c57ed7a658 /src
parent430959910f1b9b67c2553f5f46c0487b0f8a3a00 (diff)
libudev: do not set DEVNAME= twice
When we read the 'uevent' file we need to make sure, that we do not read the relative DEVNAME= path provided by the kernel and overwrite the absolute path udev expects here.
Diffstat (limited to 'src')
-rw-r--r--src/libudev-device.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/libudev-device.c b/src/libudev-device.c
index a3356cfd18..10f28b8cd5 100644
--- a/src/libudev-device.c
+++ b/src/libudev-device.c
@@ -548,16 +548,23 @@ int udev_device_read_uevent_file(struct udev_device *udev_device)
continue;
pos[0] = '\0';
- if (strncmp(line, "DEVTYPE=", 8) == 0)
+ if (strncmp(line, "DEVTYPE=", 8) == 0) {
udev_device_set_devtype(udev_device, &line[8]);
- else if (strncmp(line, "MAJOR=", 6) == 0)
+ continue;
+ }
+ if (strncmp(line, "IFINDEX=", 8) == 0) {
+ udev_device_set_ifindex(udev_device, strtoull(&line[8], NULL, 10));
+ continue;
+ }
+ if (strncmp(line, "DEVNAME=", 8) == 0) {
+ udev_device_set_devnode(udev_device, &line[8]);
+ continue;
+ }
+
+ if (strncmp(line, "MAJOR=", 6) == 0)
maj = strtoull(&line[6], NULL, 10);
else if (strncmp(line, "MINOR=", 6) == 0)
min = strtoull(&line[6], NULL, 10);
- else if (strncmp(line, "IFINDEX=", 8) == 0)
- udev_device_set_ifindex(udev_device, strtoull(&line[8], NULL, 10));
- else if (strncmp(line, "DEVNAME=", 8) == 0)
- udev_device_set_devnode(udev_device, &line[8]);
else if (strncmp(line, "DEVMODE=", 8) == 0)
udev_device->devnode_mode = strtoul(&line[8], NULL, 8);