On Mon, Feb 5, 2018 at 5:06 AM Willy Tarreau <w...@1wt.eu> wrote:

> 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.
>
>
Yikes!  Sorry about that sprintf issue.  I could have sworn I was getting
warnings from one of my compilers without the (char *) but not able to
recreate.  New patch under heading [PATCH] CONTRIB: log: exit with warning
when -sf/-sd cannot parse argument <2nd>

Thanks,

Chris


> Thanks,
> Willy
>

Reply via email to