]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-device: do not register a property with an empty string
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 9 Mar 2026 18:33:10 +0000 (03:33 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 9 Mar 2026 18:33:23 +0000 (03:33 +0900)
The function device_add_property() handles property with NULL value as
removing the property. Let's also make an empty value is handled as
same.

Note, ENV{hoge}=="" udev property handles both NULL value and an empty string
in the same way.

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

index a314f65cb23aec17a8a880e41f3abbbeda6408a2..e6b05b636a8713cb9cac0f66c2a76fcaa28e56ad 100644 (file)
@@ -92,7 +92,7 @@ int device_add_property_aux(sd_device *device, const char *key, const char *valu
         else
                 properties = &device->properties;
 
-        if (value) {
+        if (!isempty(value)) {
                 _unused_ _cleanup_free_ char *old_value = NULL;
                 _cleanup_free_ char *new_key = NULL, *new_value = NULL, *old_key = NULL;
                 int r;