From 835b05ce9f81aebb55e4de57037c810f4d372a6a Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Sat, 5 Oct 2024 11:43:57 +0200 Subject: [PATCH] subst_token(): if s is empty and tok, new_val are gien just set return string to tok=new_val (no newlines whatsoever) --- src/token.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/token.c b/src/token.c index 1049c546..8b0e801e 100644 --- a/src/token.c +++ b/src/token.c @@ -1204,6 +1204,11 @@ const char *subst_token(const char *s, const char *tok, const char *new_val) my_strdup2(_ALLOC_ID_, &result, s); return result; } + if( (!s || s[0] == '\0') && tok && new_val) { + my_strdup2(_ALLOC_ID_, &result, tok); + my_mstrcat(_ALLOC_ID_, &result, "=", new_val, NULL); + return result; + } /* quote new_val if it contains newlines and not "name" token */ if(new_val) { new_val_len = strlen(new_val);