summaryrefslogtreecommitdiff
path: root/libudev/libudev-device.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2010-12-14 11:27:02 +0100
committerKay Sievers <kay.sievers@vrfy.org>2010-12-14 11:27:02 +0100
commitff0e1f4e5d897a0ddbf365e920c0e28a6657abaa (patch)
tree35436cbfff494af264646e8d6358baba17418713 /libudev/libudev-device.c
parent14996e80d4b002dbbef9721b936fe29155375fb1 (diff)
check ifindex > 0 instead of subsystem == "net"
Diffstat (limited to 'libudev/libudev-device.c')
-rw-r--r--libudev/libudev-device.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c
index 8698d98e1c..8b0cccd533 100644
--- a/libudev/libudev-device.c
+++ b/libudev/libudev-device.c
@@ -1287,7 +1287,7 @@ const char *udev_device_get_id_filename(struct udev_device *udev_device)
major(udev_device_get_devnum(udev_device)),
minor(udev_device_get_devnum(udev_device))) < 0)
udev_device->id_filename = NULL;
- } else if (strcmp(udev_device_get_subsystem(udev_device), "net") == 0) {
+ } else if (udev_device_get_ifindex(udev_device) > 0) {
/* use netdev ifindex -- n3 */
if (asprintf(&udev_device->id_filename, "n%u", udev_device_get_ifindex(udev_device)) < 0)
udev_device->id_filename = NULL;
@@ -1582,6 +1582,8 @@ int udev_device_set_watch_handle(struct udev_device *udev_device, int handle)
int udev_device_get_ifindex(struct udev_device *udev_device)
{
+ if (!udev_device->info_loaded)
+ udev_device_read_uevent_file(udev_device);
return udev_device->ifindex;
}