From dc6358b0e1d0dca85c5d7114973adcff7ed36bfb Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Tue, 13 Nov 2018 19:11:33 +0100 Subject: [PATCH] rdline: always do substitution of '%%' Signed-off-by: David Oberhollenzer --- lib/libcfg/rdline.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/libcfg/rdline.c b/lib/libcfg/rdline.c index b0cd789..87d431e 100644 --- a/lib/libcfg/rdline.c +++ b/lib/libcfg/rdline.c @@ -142,6 +142,8 @@ static void substitute(rdline_t *t, char *dst, char *src) *(dst++) = *(src++); } } + + *(dst++) = '\0'; } int rdline(rdline_t *t) @@ -156,8 +158,10 @@ int rdline(rdline_t *t) goto out; } while (t->line[0] == '\0'); - if (ret == 0) + if (ret == 0) { + substitute(t, t->line, t->line); return 0; + } buffer = calloc(1, strlen(t->line) + ret + 1); if (buffer == NULL) {