Hello t...@!

This diff eliminates the latest atoi() for strtonum()

Index: ifconfig.c
===================================================================
RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v
retrieving revision 1.224
diff -u -p -r1.224 ifconfig.c
--- ifconfig.c  9 Dec 2009 21:21:57 -0000       1.224
+++ ifconfig.c  14 Dec 2009 08:29:01 -0000
@@ -1724,9 +1727,11 @@ setifchan(const char *val, int d)
        if (d != 0)
                chan = IEEE80211_CHAN_ANY;
        else {
-               chan = atoi(val);
-               if (chan < 1 || chan > 256) {
-                       warnx("invalid channel: %s", val);
+               const char      *errstr;
+
+               chan = strtonum(val, 1, 256, &errstr);
+               if (errstr) {
+                       warnx("invalid channel (%s): %s", errstr, val);
                        return;
                }
        }

Reply via email to