X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=libudev%2Flibudev-device-private.c;h=b78b6c9553503b61e0c9aa07731c6ce2b894b2da;hb=6ed03d1e2c1e2e300dda7a7cf4a5ffe10ef18356;hp=6d72d328bd88eab4ffe4355b4607a861e3954ae9;hpb=4ec9c3e79771aa95586390cecff4218cc8938160;p=elogind.git diff --git a/libudev/libudev-device-private.c b/libudev/libudev-device-private.c index 6d72d328b..b78b6c955 100644 --- a/libudev/libudev-device-private.c +++ b/libudev/libudev-device-private.c @@ -86,7 +86,7 @@ static bool device_has_info(struct udev_device *udev_device) if (udev_device_get_devlink_priority(udev_device) != 0) return true; udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) - if (udev_list_entry_get_flags(list_entry)) + if (udev_list_entry_get_num(list_entry)) return true; if (udev_device_get_tags_list_entry(udev_device) != NULL) return true; @@ -134,6 +134,13 @@ int udev_device_update_db(struct udev_device *udev_device) return -1; } + /* + * set 'sticky' bit to indicate that we should not clean the + * database when we transition from initramfs to the real root + */ + if (udev_device_get_db_persist(udev_device)) + fchmod(fileno(f), 01644); + if (has_info) { size_t devlen = strlen(udev_get_dev_path(udev))+1; struct udev_list_entry *list_entry; @@ -150,7 +157,7 @@ int udev_device_update_db(struct udev_device *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)) + if (!udev_list_entry_get_num(list_entry)) continue; fprintf(f, "E:%s=%s\n", udev_list_entry_get_name(list_entry),