diff options
author | jmmv <jmmv@FreeBSD.org> | 2014-04-17 11:49:19 +0000 |
---|---|---|
committer | jmmv <jmmv@FreeBSD.org> | 2014-04-17 11:49:19 +0000 |
commit | 8181a88b7a4914fa27f557d840506cf0b17eb80a (patch) | |
tree | 2d298f38d9e654fc31baefb3b7f03d7aa3b24f93 /lib/libc/net | |
parent | a46245cd5cdc90472b3a24e89daeed1c7faadf70 (diff) | |
download | FreeBSD-src-8181a88b7a4914fa27f557d840506cf0b17eb80a.zip FreeBSD-src-8181a88b7a4914fa27f557d840506cf0b17eb80a.tar.gz |
MFC r263090: Make ether_line really report an error when all input is invalid.
Diffstat (limited to 'lib/libc/net')
-rw-r--r-- | lib/libc/net/ether_addr.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/libc/net/ether_addr.c b/lib/libc/net/ether_addr.c index 5d72606..19d10ac 100644 --- a/lib/libc/net/ether_addr.c +++ b/lib/libc/net/ether_addr.c @@ -72,11 +72,13 @@ ether_line(const char *l, struct ether_addr *e, char *hostname) i = sscanf(l, "%x:%x:%x:%x:%x:%x %s", &o[0], &o[1], &o[2], &o[3], &o[4], &o[5], hostname); - if (i != 7) - return (i); - for (i=0; i<6; i++) - e->octet[i] = o[i]; - return (0); + if (i == 7) { + for (i = 0; i < 6; i++) + e->octet[i] = o[i]; + return (0); + } else { + return (-1); + } } /* |