Hi tech@,

Was reading through ifconfig.c today and noticed something odd (to me).

Very well could be my ignorance, but it looks like since rev 1.203
there's been an unused if statement around the ioctl call while
processing media commands. It very well could be by design to allow
execution to continue back in main(), but if so the if statement seems
unnecessary. (Since I don't know the intent here, I honestly can't
say.)

Here's a diff adding the original error back.

-Dave

Index: ifconfig.c
===================================================================
RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v
retrieving revision 1.348
diff -u -p -u -p -r1.348 ifconfig.c
--- ifconfig.c  29 Aug 2017 21:10:20 -0000      1.348
+++ ifconfig.c  11 Sep 2017 17:39:30 -0000
@@ -2449,7 +2449,7 @@ process_media_commands(void)
        ifr.ifr_media = media_current;

        if (ioctl(s, SIOCSIFMEDIA, (caddr_t)&ifr) < 0)
-               ;
+               err(1, "SIOCSIFMEDIA");
 }

 /* ARGSUSED */

Reply via email to