From 6eae4da9747559c1bfd7fedebe8c0dda9bf5bce6 Mon Sep 17 00:00:00 2001 From: Girish Joshi Date: Mon, 8 Feb 2021 00:39:26 +0530 Subject: [PATCH] lib/argp-help.c: Corrected the default value and usage for inp_text_limit in argp_doc() This fixes an old glibc bug --- lib/argp-help.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/argp-help.c b/lib/argp-help.c index ac1804d89..e9ac4a19d 100644 --- a/lib/argp-help.c +++ b/lib/argp-help.c @@ -1590,7 +1590,7 @@ argp_doc (const struct argp *argp, const struct argp_state *state, const char *inp_text; void *input = 0; int anything = 0; - size_t inp_text_limit = 0; + size_t inp_text_limit = -1; const char *doc = argp->doc ? dgettext (argp->argp_domain, argp->doc) : NULL; const struct argp_child *child = argp->children; @@ -1598,7 +1598,7 @@ argp_doc (const struct argp *argp, const struct argp_state *state, { char *vt = strchr (doc, '\v'); inp_text = post ? (vt ? vt + 1 : 0) : doc; - inp_text_limit = (!post && vt) ? (vt - doc) : 0; + inp_text_limit = (!post && vt) ? (vt - doc) : -1; } else inp_text = 0; @@ -1624,7 +1624,7 @@ argp_doc (const struct argp *argp, const struct argp_state *state, if (pre_blank) __argp_fmtstream_putc (stream, '\n'); - if (text == inp_text && inp_text_limit) + if (text == inp_text && inp_text_limit != -1) __argp_fmtstream_write (stream, inp_text, inp_text_limit); else __argp_fmtstream_puts (stream, text); -- 2.26.2