]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: init: Add missing brackets in the code parsing -sf/-st
authorAurélien Nephtali <aurelien.nephtali@gmail.com>
Sat, 17 Feb 2018 19:53:11 +0000 (20:53 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 19 Feb 2018 07:02:21 +0000 (08:02 +0100)
The codes tries to strip trailing spaces of arguments but due to missing
brackets, it will always exit.

It can be reproduced with this (silly) example:

$ haproxy -f /etc/haproxy/haproxy.cfg -sf 1234 "1235 " 1236
$ echo $?
1

This was introduced in commit 236062f7c ("MINOR: init: emit warning when
-sf/-sd cannot parse argument")

Signed-off-by: Aurélien Nephtali <aurelien.nephtali@gmail.com>
src/haproxy.c

index 98b18dafa67ff99c4a8c48bae5ba4b3d696c8fa5..8785b9f94990b52c59b9e57e0e06b858513a2690 100644 (file)
@@ -1461,10 +1461,11 @@ static void init(int argc, char **argv)
                                                exit(1);
                                        } else if (endptr && strlen(endptr)) {
                                                while (isspace(*endptr)) endptr++;
-                                               if (*endptr != 0)
+                                               if (*endptr != 0) {
                                                        ha_alert("-%2s option: some bytes unconsumed in PID list {%s}\n",
                                                                 flag, endptr);
                                                        exit(1);
+                                               }
                                        }
                                        if (oldpids[nb_oldpids] <= 0)
                                                usage(progname);