diff options
author | 2009-12-14 17:14:56 +0000 | |
---|---|---|
committer | 2009-12-14 17:14:56 +0000 | |
commit | 59e695debf0a66f26ba50165b9be02724690fed1 (patch) | |
tree | cf1071e9009f22fdce561bab22711a2cd7753b84 | |
parent | Impose sessions limit on the delivery sessions (mta and mda). (diff) | |
download | wireguard-openbsd-59e695debf0a66f26ba50165b9be02724690fed1.tar.xz wireguard-openbsd-59e695debf0a66f26ba50165b9be02724690fed1.zip |
use strtonum() instead of atoi(). idea from Vladimir Kirillov, but had
to rewrite it because it was another mangled diff in mail. When will
people learn that the tabs and spaces are important?
-rw-r--r-- | sbin/ifconfig/ifconfig.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index 2d67c63b398..43f7d4c7cf1 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ifconfig.c,v 1.224 2009/12/09 21:21:57 deraadt Exp $ */ +/* $OpenBSD: ifconfig.c,v 1.225 2009/12/14 17:14:56 deraadt Exp $ */ /* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */ /* @@ -1713,6 +1713,7 @@ void setifchan(const char *val, int d) { struct ieee80211chanreq channel; + const char *errstr; int chan; if (val == NULL) { @@ -1724,9 +1725,9 @@ 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); + chan = strtonum(val, 1, 256, &errstr); + if (errstr) { + warnx("invalid channel %s: %s", val, errstr); return; } } |