bin/54672: [PATCH] fix gcc 3.3 compiler warning for ifconfig(8)
Lukas Ertl
l.ertl at univie.ac.at
Mon Jul 21 06:50:15 PDT 2003
The following reply was made to PR bin/54672; it has been noted by GNATS.
From: Lukas Ertl <l.ertl at univie.ac.at>
To: Bruce Evans <bde at zeta.org.au>
Cc: FreeBSD-gnats-submit at freebsd.org
Subject: Re: bin/54672: [PATCH] fix gcc 3.3 compiler warning for ifconfig(8)
Date: Mon, 21 Jul 2003 15:43:24 +0200 (CEST)
On Mon, 21 Jul 2003, Bruce Evans wrote:
> On Mon, 21 Jul 2003, Lukas Ertl wrote:
> > ...
> > - u_short first = 123, last = 123;
> > + u_int first = 123, last = 123;
> > + char *p, *endptr;
>
> The new lines should be:
>
> char *endptr, *p;
> u_long first, last;
>
> This fixes about 4 style bugs (initialization, indentation, inter-line order
> and intra-line order) , and 1 overflow bug (see below).
Ok, I guess I'm not too familiar with style(9) :-)
> > +
> > + if ((p = strchr(range, '-')) == NULL)
> > + errx(1, "illegal range '%s'", range);
>
> strtoul() could be used to read up to the '-' more directly.
>
> There are complications for invalid formats with '-' signs in the
> numbers. Both strtoul() and sscanf() will parse the '-' signs as
> parts of numbers, but we don't want that here. I think we also
> don't want any leading whitespace.
So we need strchr(), don't we?
regards,
le
--
Lukas Ertl eMail: l.ertl at univie.ac.at
UNIX Systemadministrator Tel.: (+43 1) 4277-14073
Vienna University Computer Center Fax.: (+43 1) 4277-9140
University of Vienna http://mailbox.univie.ac.at/~le/
More information about the freebsd-bugs
mailing list