]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-device: try to get DISKSEQ from uevent file
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 30 Mar 2022 18:27:17 +0000 (03:27 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 30 Mar 2022 22:25:24 +0000 (07:25 +0900)
Otherwise, if the sd-device object is created from e.g. syspath, then
sd_device_get_diskseq() returns -ENOENT.

src/libsystemd/sd-device/sd-device.c

index e7d398dbb0acb7c11bf2f04eda54f36d7c028085..545a0f5a5d763158645914dda64584e37ed34b94 100644 (file)
@@ -1138,8 +1138,14 @@ _public_ int sd_device_get_seqnum(sd_device *device, uint64_t *ret) {
 }
 
 _public_ int sd_device_get_diskseq(sd_device *device, uint64_t *ret) {
+        int r;
+
         assert_return(device, -EINVAL);
 
+        r = device_read_uevent_file(device);
+        if (r < 0)
+                return r;
+
         if (device->diskseq == 0)
                 return -ENOENT;