Code like this should match the EXAMPLE in the strtoul manual page. This shit happens everytime someone tries to take a shortcut, sadly.
> Fix clang warning about tautological compare: an unsigned long can't > be negative. > > ok? Or dlg@ can slip it in with his next ifconfig change. > > Index: brconfig.c > =================================================================== > RCS file: /cvs/src/sbin/ifconfig/brconfig.c,v > retrieving revision 1.14 > diff -u -p -r1.14 brconfig.c > --- brconfig.c 28 Nov 2016 10:12:50 -0000 1.14 > +++ brconfig.c 7 Jun 2017 15:54:40 -0000 > @@ -581,8 +581,7 @@ bridge_ifcost(const char *ifname, const > > errno = 0; > v = strtoul(val, &endptr, 0); > - if (val[0] == '\0' || endptr[0] != '\0' || > - v < 0 || v > 0xffffffffUL || > + if (val[0] == '\0' || endptr[0] != '\0' || v > 0xffffffffUL || > (errno == ERANGE && v == ULONG_MAX)) > errx(1, "invalid arg for ifcost: %s", val); > > -- > Christian "naddy" Weisgerber [email protected] >
