mirror of
https://github.com/systemd/systemd.git
synced 2026-11-08 06:16:55 +00:00
sd-json: make sure SD_JSON_BUILD_STRING_UNDERSCORIFY() can deal with NULL strings
SD_JSON_BUILD_STRING() and everything else can deal with it, make sure SD_JSON_BUILD_STRING_UNDERSCORIFY() can too. (cherry picked from commita77a95665f) (cherry picked from commit29f4fba3c6) (cherry picked from commita09efa6cf5)
This commit is contained in:
1 parent
c76657a9bd
commit
a7a252dc16
1 file changed
+1
-1
@@ -3532,7 +3532,7 @@ _public_ int sd_json_buildv(sd_json_variant **ret, va_list ap) {
|
||||
if (current->n_suppress == 0) {
|
||||
_cleanup_free_ char *c = NULL;
|
||||
|
||||
if (command == _JSON_BUILD_STRING_UNDERSCORIFY) {
|
||||
if (command == _JSON_BUILD_STRING_UNDERSCORIFY && p) {
|
||||
c = strreplace(p, "-", "_");
|
||||
if (!c) {
|
||||
r = -ENOMEM;
|
||||
|
||||
Reference in new issue
Block a user