]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-device: logs about refused property
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 11 Mar 2026 20:19:25 +0000 (05:19 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 17 May 2026 16:55:10 +0000 (01:55 +0900)
Follow-up for a62cd5a153ffe18c27aff02685ed75c5bc4509a2.

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

index ae44d0c86fd96dfa6f24409a5fba398ada3e1d5e..9d9ac7d4300f9d718bb240abf7cc19558af9c07f 100644 (file)
@@ -15,6 +15,7 @@
 #include "dirent-util.h"
 #include "env-util.h"
 #include "errno-util.h"
+#include "escape.h"
 #include "extract-word.h"
 #include "fd-util.h"
 #include "fileio.h"
@@ -108,8 +109,15 @@ int device_add_property_aux(sd_device *device, const char *key, const char *valu
         assert(device);
         assert(key);
 
-        if (!property_is_valid(key, value))
+        if (!property_is_valid(key, value)) {
+                if (DEBUG_LOGGING) {
+                        _cleanup_free_ char *escaped_key = cescape(key),
+                                *escaped_value = cescape(strempty(value));
+                        log_device_debug(device, "sd-device: Refusing invalid property: %s=%s",
+                                         strnull(escaped_key), strnull(escaped_value));
+                }
                 return -EINVAL;
+        }
 
         if (db)
                 properties = &device->properties_db;