X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=libudev%2Flibudev-device-private.c;h=3afa82e04f40b3869caf0afbb2a82daa93c71267;hb=95ce1875d79162324a5eb67f6a0ffbbdd5d29921;hp=406d8704f54e465f2d761cdce06e5f54d1a2b76f;hpb=14996e80d4b002dbbef9721b936fe29155375fb1;p=elogind.git diff --git a/libudev/libudev-device-private.c b/libudev/libudev-device-private.c index 406d8704f..3afa82e04 100644 --- a/libudev/libudev-device-private.c +++ b/libudev/libudev-device-private.c @@ -78,6 +78,7 @@ int udev_device_tag_index(struct udev_device *dev, struct udev_device *dev_old, static bool device_has_info(struct udev_device *udev_device) { + struct udev *udev = udev_device_get_udev(udev_device); struct udev_list_entry *list_entry; if (udev_device_get_devlinks_list_entry(udev_device) != NULL) @@ -89,9 +90,12 @@ static bool device_has_info(struct udev_device *udev_device) return true; if (udev_device_get_tags_list_entry(udev_device) != NULL) return true; - if (udev_device_get_knodename(udev_device) != NULL) - if (strcmp(udev_device_get_devnode(udev_device), udev_device_get_knodename(udev_device)) != 0) + if (udev_device_get_devnode(udev_device) != NULL && udev_device_get_knodename(udev_device) != NULL) { + size_t devlen = strlen(udev_get_dev_path(udev))+1; + + if (strcmp(&udev_device_get_devnode(udev_device)[devlen], udev_device_get_knodename(udev_device)) != 0) return true; + } if (udev_device_get_watch_handle(udev_device) >= 0) return true; return false; @@ -114,7 +118,9 @@ int udev_device_update_db(struct udev_device *udev_device) util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/db/", id, NULL); /* do not store anything for otherwise empty devices */ - if (!has_info && udev_device_get_devnode(udev_device) == NULL) { + if (!has_info && + major(udev_device_get_devnum(udev_device)) == 0 && + udev_device_get_ifindex(udev_device) == 0) { unlink(filename); return 0; } @@ -141,6 +147,8 @@ int udev_device_update_db(struct udev_device *udev_device) fprintf(f, "L:%i\n", udev_device_get_devlink_priority(udev_device)); if (udev_device_get_watch_handle(udev_device) >= 0) fprintf(f, "W:%i\n", udev_device_get_watch_handle(udev_device)); + if (udev_device_get_usec_initialized(udev_device) > 0) + fprintf(f, "I:%llu\n", udev_device_get_usec_initialized(udev_device)); udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { if (!udev_list_entry_get_flags(list_entry)) continue;