Hi Chris,
On Sat, Feb 03, 2018 at 10:08:58PM +0000, Chris Lane wrote:
> diff --git a/src/haproxy.c b/src/haproxy.c
> index f1a2fb9..30490b3 100644
> --- a/src/haproxy.c
> +++ b/src/haproxy.c
> @@ -1445,13 +1445,26 @@ static void init(int argc, char **argv)
> else
> oldpids_sig = SIGTERM; /* terminate
> immediately */
> while (argc > 1 && argv[1][0] != '-') {
> + char * endptr = NULL;
> oldpids = realloc(oldpids, (nb_oldpids
> + 1) * sizeof(int));
> if (!oldpids) {
> ha_alert("Cannot allocate old
> pid : out of memory.\n");
> exit(1);
> }
> argc--; argv++;
> - oldpids[nb_oldpids] = atol(*argv);
> + errno = 0;
> + oldpids[nb_oldpids] = strtol(*argv,
> &endptr, 10);
> + if (errno) {
> + ha_alert("-%2s option: failed
> to parse {%s}: %s\n",
> + (char *)*argv, (char
> *)strerror(errno));
I'm seeing a missing argument here: there are 3 "%s" fields but only 2
given. Also, you don't need to cast them to "char *", it's already OK.
Thanks,
Willy