Author: jmmv
Date: Thu Apr 17 11:49:19 2014
New Revision: 264592
URL: http://svnweb.freebsd.org/changeset/base/264592

Log:
  MFC r263090: Make ether_line really report an error when all input is invalid.

Modified:
  stable/10/lib/libc/net/ether_addr.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/net/ether_addr.c
==============================================================================
--- stable/10/lib/libc/net/ether_addr.c Thu Apr 17 11:48:34 2014        
(r264591)
+++ stable/10/lib/libc/net/ether_addr.c Thu Apr 17 11:49:19 2014        
(r264592)
@@ -72,11 +72,13 @@ ether_line(const char *l, struct ether_a
 
        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);
+       }
 }
 
 /*
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to