summaryrefslogtreecommitdiffstats
path: root/src/storagetm
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2023-11-14 03:58:22 +0100
committerLennart Poettering <lennart@poettering.net>2023-11-14 08:52:40 +0100
commit921961c3a3d3301af290e69e132a5667c1d68355 (patch)
tree30d1f9c286f4c4786c0d5b7d7746541ef053c1e7 /src/storagetm
parentselinux: fix loading policy at early boot (diff)
downloadsystemd-921961c3a3d3301af290e69e132a5667c1d68355.tar.xz
systemd-921961c3a3d3301af290e69e132a5667c1d68355.zip
storagetm: use path to device node instead of devpath
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.
Diffstat (limited to 'src/storagetm')
-rw-r--r--src/storagetm/storagetm.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/storagetm/storagetm.c b/src/storagetm/storagetm.c
index c9f6dd9214..ae63baaf79 100644
--- a/src/storagetm/storagetm.c
+++ b/src/storagetm/storagetm.c
@@ -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);