Package: moreutils
Version: 0.9
Severity: normal
Tags: patch

$ ifdata -ph foo
ioctl: No such device
00:00:00:00:00:00

The attached patch changes the behaviour to

$ ifdata -ph foo
ioctl: No such device

without printing the bogus hwaddr.


Adam
-- 
Adam                 [EMAIL PROTECTED]
  Lackorzynski         http://os.inf.tu-dresden.de/~adam/
Index: ifdata.c
===================================================================
--- ifdata.c    (revision 35)
+++ ifdata.c    (working copy)
@@ -152,9 +152,7 @@
 
        PREPARE_SOCK(iface);
        CALL_IOCTL(SIOCGIFHWADDR);
-       if (res < 0) {
-               CALL_ERROR();
-       }
+       CALL_ERROR(return);
        hwaddr = (unsigned char *)req.ifr_hwaddr.sa_data;
        printf("%02X:%02X:%02X:%02X:%02X:%02X",
                hwaddr[0], hwaddr[1], hwaddr[2], hwaddr[3], hwaddr[4], 
hwaddr[5]);

Reply via email to