xatonum.h: add comment
[oweals/busybox.git] / networking / ifconfig.c
index 5e11b2b7c4ca45d90c074cc25626e7c3d5db59bf..3dcb118ee0f127d1d85be59d1a06e83ebc321464 100644 (file)
@@ -261,7 +261,7 @@ static int in_ether(const char *bufp, struct sockaddr *sap);
  * Our main function.
  */
 
-int ifconfig_main(int argc, char **argv);
+int ifconfig_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 int ifconfig_main(int argc, char **argv)
 {
        struct ifreq ifr;
@@ -402,12 +402,10 @@ int ifconfig_main(int argc, char **argv)
 
                                                                /* Create a channel to the NET kernel. */
                                                                sockfd6 = xsocket(AF_INET6, SOCK_DGRAM, 0);
-                                                               if (ioctl(sockfd6, SIOGIFINDEX, &ifr) < 0)
-                                                                       bb_perror_msg_and_die("SIOGIFINDEX");
+                                                               xioctl(sockfd6, SIOGIFINDEX, &ifr);
                                                                ifr6.ifr6_ifindex = ifr.ifr_ifindex;
                                                                ifr6.ifr6_prefixlen = prefix_len;
-                                                               if (ioctl(sockfd6, a1op->selector, &ifr6) < 0)
-                                                                       bb_perror_msg_and_die(a1op->name);
+                                                               ioctl_or_perror_and_die(sockfd6, a1op->selector, &ifr6, "%s", a1op->name);
                                                                if (ENABLE_FEATURE_CLEAN_UP)
                                                                        free(lsa);
                                                                continue;
@@ -444,8 +442,7 @@ int ifconfig_main(int argc, char **argv)
                                        p = ((char *)&ifr) + a1op->ifr_offset;
 #if ENABLE_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ
                                        if (mask & A_MAP_TYPE) {
-                                               if (ioctl(sockfd, SIOCGIFMAP, &ifr) < 0)
-                                                       bb_perror_msg_and_die("SIOCGIFMAP");
+                                               xioctl(sockfd, SIOCGIFMAP, &ifr);
                                                if ((mask & A_MAP_UCHAR) == A_MAP_UCHAR)
                                                        *((unsigned char *) p) = i;
                                                else if (mask & A_MAP_USHORT)
@@ -460,8 +457,7 @@ int ifconfig_main(int argc, char **argv)
                                                *((int *) p) = i;
                                }
 
-                               if (ioctl(sockfd, a1op->selector, &ifr) < 0)
-                                       bb_perror_msg_and_die(a1op->name);
+                               ioctl_or_perror_and_die(sockfd, a1op->selector, &ifr, "%s", a1op->name);
 #ifdef QUESTIONABLE_ALIAS_CASE
                                if (mask & A_COLON_CHK) {
                                        /*
@@ -486,15 +482,13 @@ int ifconfig_main(int argc, char **argv)
                        mask = N_SET;
                }
 
-               if (ioctl(sockfd, SIOCGIFFLAGS, &ifr) < 0)
-                       bb_perror_msg_and_die("SIOCGIFFLAGS");
+               xioctl(sockfd, SIOCGIFFLAGS, &ifr);
                selector = op->selector;
                if (mask & SET_MASK)
                        ifr.ifr_flags |= selector;
                else
                        ifr.ifr_flags &= ~selector;
-               if (ioctl(sockfd, SIOCSIFFLAGS, &ifr) < 0)
-                       bb_perror_msg_and_die("SIOCSIFFLAGS");
+               xioctl(sockfd, SIOCSIFFLAGS, &ifr);
        } /* while () */
 
        if (ENABLE_FEATURE_CLEAN_UP)