aboutsummaryrefslogtreecommitdiff
path: root/toys/pending/route.c
diff options
context:
space:
mode:
authorEric Molitor <emolitor@molitor.org>2020-05-25 14:25:46 +0100
committerRob Landley <rob@landley.net>2020-05-26 00:21:45 -0500
commitd565cf631cdd5bdeaa7be00be83516bb649446a1 (patch)
tree31a3e2d84564a0172b59627d9914423d0e2ca463 /toys/pending/route.c
parentb79f2e8c6e1fe5c6c518bf801cbc5a7eef06e381 (diff)
downloadtoybox-d565cf631cdd5bdeaa7be00be83516bb649446a1.tar.gz
Use perror_exit to replace exit calls.
Diffstat (limited to 'toys/pending/route.c')
-rw-r--r--toys/pending/route.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/toys/pending/route.c b/toys/pending/route.c
index fba5f717..2de3e831 100644
--- a/toys/pending/route.c
+++ b/toys/pending/route.c
@@ -77,13 +77,13 @@ static struct _arglist arglist2[] = {
void xsend(int sockfd, void *buf, size_t len)
{
- if (send(sockfd, buf, len, 0) != len) exit(EXIT_FAILURE);
+ if (send(sockfd, buf, len, 0) != len) perror_exit("xsend");
}
int xrecv(int sockfd, void *buf, size_t len)
{
int msg_len = recv(sockfd, buf, len, 0);
- if (msg_len < 0) exit(EXIT_FAILURE);
+ if (msg_len < 0) perror_exit("xrecv");
return msg_len;
}
@@ -382,7 +382,7 @@ static void setroute(char **argv)
{
struct rtentry rt;
char *netmask, *targetip;
- int is_net_or_host = 0, sokfd, arg2_action;
+ int is_net_or_host, sockfd, arg2_action;
int action = get_action(&argv, arglist1); //verify the arg for add/del.
if (!action || !*argv) help_exit("setroute");
@@ -414,10 +414,10 @@ static void setroute(char **argv)
if ((action == 1) && (rt.rt_flags & RTF_HOST))
(((struct sockaddr_in *)&((rt).rt_genmask))->sin_addr.s_addr) = INVALID_ADDR;
- sokfd = xsocket(AF_INET, SOCK_DGRAM, 0);
- if (action == 1) xioctl(sokfd, SIOCADDRT, &rt);
- else xioctl(sokfd, SIOCDELRT, &rt);
- xclose(sokfd);
+ sockfd = xsocket(AF_INET, SOCK_DGRAM, 0);
+ if (action == 1) xioctl(sockfd, SIOCADDRT, &rt);
+ else xioctl(sockfd, SIOCDELRT, &rt);
+ xclose(sockfd);
}
/*