]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
storagetm: use path to device node instead of devpath
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 14 Nov 2023 02:58:22 +0000 (11:58 +0900)
committerLennart Poettering <lennart@poettering.net>
Tue, 14 Nov 2023 07:52:40 +0000 (08:52 +0100)
To make the generated IDs equivalent when
- sd_device object is not provided,
- sd_device object is provided, but it does not have ID_SERIAL.

Follow-up for abc19a6ffaa94893ffc40cc000e5bb4437f67656.

This also fixes missing voidification.

Fixes CID#1524253.

src/storagetm/storagetm.c

index c9f6dd9214e73de3432f5671eba04ea961907ea0..ae63baaf792a11b1de5e63f6fba1a64f0783815b 100644 (file)
@@ -326,8 +326,9 @@ static int nvme_namespace_write_metadata(int namespace_fd, sd_device *device, co
                 if (device) {
                         (void) sd_device_get_property_value(device, "ID_SERIAL", &serial);
                         if (!serial)
-                                sd_device_get_devpath(device, &serial);
-                } else
+                                (void) sd_device_get_devname(device, &serial);
+                }
+                if (!serial)
                         serial = node;
 
                 r = sd_id128_get_machine(&mid);