start_stop_daemon: NOMMU fixes, round 2 by Alex Landau <landau_alex@yahoo.com>
[oweals/busybox.git] / networking / route.c
index b5490ddd8d12e08710ea63133a4fa4e66f7be4bd..530c51b1017c42aca2aa5656f2f6e7b820cae2ee 100644 (file)
@@ -327,9 +327,10 @@ static void INET_setroute(int action, char **args)
        /* Create a socket to the INET kernel. */
        skfd = xsocket(AF_INET, SOCK_DGRAM, 0);
 
-       if (ioctl(skfd, ((action==RTACTION_ADD) ? SIOCADDRT : SIOCDELRT), &rt)<0) {
-               bb_perror_msg_and_die("SIOC[ADD|DEL]RT");
-       }
+       if (action == RTACTION_ADD)
+               xioctl(skfd, SIOCADDRT, &rt);
+       else
+               xioctl(skfd, SIOCDELRT, &rt);
 
        if (ENABLE_FEATURE_CLEAN_UP) close(skfd);
 }
@@ -423,17 +424,15 @@ static void INET6_setroute(int action, char **args)
                struct ifreq ifr;
                memset(&ifr, 0, sizeof(ifr));
                strncpy(ifr.ifr_name, devname, sizeof(ifr.ifr_name));
-
-               if (ioctl(skfd, SIOGIFINDEX, &ifr) < 0) {
-                       bb_perror_msg_and_die("SIOGIFINDEX");
-               }
+               xioctl(skfd, SIOGIFINDEX, &ifr);
                rt.rtmsg_ifindex = ifr.ifr_ifindex;
        }
 
        /* Tell the kernel to accept this route. */
-       if (ioctl(skfd, ((action==RTACTION_ADD) ? SIOCADDRT : SIOCDELRT), &rt)<0) {
-               bb_perror_msg_and_die("SIOC[ADD|DEL]RT");
-       }
+       if (action == RTACTION_ADD)
+               xioctl(skfd, SIOCADDRT, &rt);
+       else
+               xioctl(skfd, SIOCDELRT, &rt);
 
        if (ENABLE_FEATURE_CLEAN_UP) close(skfd);
 }