]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-json: fix conditions
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 24 Apr 2025 05:52:08 +0000 (14:52 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 24 Apr 2025 21:06:38 +0000 (06:06 +0900)
Fixes a bug in 6647bbeab13fb115ecd0b389963001e978da1fce (v257).

Fixes CID#1609496.

src/libsystemd/sd-json/sd-json.c

index 494f3379f7620a39aaaee1de986646febb7adeb7..fa8c25da8a1256f93ea61fef9aea8c7087fd813d 100644 (file)
@@ -4911,10 +4911,10 @@ _public_ int sd_json_buildv(sd_json_variant **ret, va_list ap) {
                                 if (r < 0)
                                         goto finish;
 
-                                r = command == _SD_JSON_BUILD_BASE64    ? sd_json_variant_new_base64(&add_more, p, sz) :
-                                    command == _SD_JSON_BUILD_BASE32HEX ? sd_json_variant_new_base32hex(&add_more, p, sz) :
-                                    command == _SD_JSON_BUILD_HEX       ? sd_json_variant_new_hex(&add_more, p, sz) :
-                                                                          sd_json_variant_new_octescape(&add_more, p, sz);
+                                r = command == _JSON_BUILD_PAIR_BASE64_NON_EMPTY    ? sd_json_variant_new_base64(&add_more, p, sz) :
+                                    command == _JSON_BUILD_PAIR_BASE32HEX_NON_EMPTY ? sd_json_variant_new_base32hex(&add_more, p, sz) :
+                                    command == _JSON_BUILD_PAIR_HEX_NON_EMPTY       ? sd_json_variant_new_hex(&add_more, p, sz) :
+                                                                                      sd_json_variant_new_octescape(&add_more, p, sz);
                                 if (r < 0)
                                         goto finish;
                         }