diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2023-06-15 11:55:56 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2023-06-15 11:55:56 +0200 |
commit | 648f506949ded749e28186d0092b6e42085c897b (patch) | |
tree | 049c72bc8149f41fc617d00f7d32f1d6384f8e2f /networking | |
parent | 61a4959251667751e424e600c6cb75de39d6b1c3 (diff) | |
download | busybox-w32-648f506949ded749e28186d0092b6e42085c897b.tar.gz busybox-w32-648f506949ded749e28186d0092b6e42085c897b.tar.bz2 busybox-w32-648f506949ded749e28186d0092b6e42085c897b.zip |
libbb: code shrink: introduce and use [_]exit_FAILURE()
function old new delta
exit_FAILURE - 7 +7
_exit_FAILURE - 7 +7
run 198 199 +1
restore_state_and_exit 114 115 +1
xbsd_write_bootstrap 399 397 -2
vfork_compressor 209 207 -2
sig_handler 12 10 -2
serial_ctl 154 152 -2
parse_args 1169 1167 -2
onintr 21 19 -2
make_new_session 493 491 -2
login_main 988 986 -2
gotsig 35 33 -2
do_iplink 1315 1313 -2
addgroup_main 397 395 -2
inetd_main 1911 1908 -3
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 2/12 up/down: 16/-25) Total: -9 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking')
-rw-r--r-- | networking/inetd.c | 4 | ||||
-rw-r--r-- | networking/libiproute/iplink.c | 2 | ||||
-rw-r--r-- | networking/libiproute/iptunnel.c | 2 | ||||
-rw-r--r-- | networking/ping.c | 2 | ||||
-rw-r--r-- | networking/slattach.c | 2 | ||||
-rw-r--r-- | networking/telnetd.c | 2 |
6 files changed, 7 insertions, 7 deletions
diff --git a/networking/inetd.c b/networking/inetd.c index fb2fbe323..e63edcd9d 100644 --- a/networking/inetd.c +++ b/networking/inetd.c | |||
@@ -1449,7 +1449,7 @@ int inetd_main(int argc UNUSED_PARAM, char **argv) | |||
1449 | else | 1449 | else |
1450 | sep->se_builtin->bi_dgram_fn(ctrl, sep); | 1450 | sep->se_builtin->bi_dgram_fn(ctrl, sep); |
1451 | if (pid) /* we did fork */ | 1451 | if (pid) /* we did fork */ |
1452 | _exit(EXIT_FAILURE); | 1452 | _exit_FAILURE(); |
1453 | maybe_close(accepted_fd); | 1453 | maybe_close(accepted_fd); |
1454 | continue; /* -> check next fd in fd set */ | 1454 | continue; /* -> check next fd in fd set */ |
1455 | } | 1455 | } |
@@ -1530,7 +1530,7 @@ int inetd_main(int argc UNUSED_PARAM, char **argv) | |||
1530 | /* eat packet in udp case */ | 1530 | /* eat packet in udp case */ |
1531 | if (sep->se_socktype != SOCK_STREAM) | 1531 | if (sep->se_socktype != SOCK_STREAM) |
1532 | recv(0, line, LINE_SIZE, MSG_DONTWAIT); | 1532 | recv(0, line, LINE_SIZE, MSG_DONTWAIT); |
1533 | _exit(EXIT_FAILURE); | 1533 | _exit_FAILURE(); |
1534 | } /* for (sep = servtab...) */ | 1534 | } /* for (sep = servtab...) */ |
1535 | } /* for (;;) */ | 1535 | } /* for (;;) */ |
1536 | } | 1536 | } |
diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c index 68d199044..9eb0b4f5f 100644 --- a/networking/libiproute/iplink.c +++ b/networking/libiproute/iplink.c | |||
@@ -215,7 +215,7 @@ static void parse_address(char *dev, int hatype, int halen, char *lla, struct if | |||
215 | alen = hatype == 1/*ARPHRD_ETHER*/ ? 14/*ETH_HLEN*/ : 19/*INFINIBAND_HLEN*/; | 215 | alen = hatype == 1/*ARPHRD_ETHER*/ ? 14/*ETH_HLEN*/ : 19/*INFINIBAND_HLEN*/; |
216 | alen = ll_addr_a2n((unsigned char *)(ifr->ifr_hwaddr.sa_data), alen, lla); | 216 | alen = ll_addr_a2n((unsigned char *)(ifr->ifr_hwaddr.sa_data), alen, lla); |
217 | if (alen < 0) | 217 | if (alen < 0) |
218 | exit(EXIT_FAILURE); | 218 | exit_FAILURE(); |
219 | if (alen != halen) { | 219 | if (alen != halen) { |
220 | bb_error_msg_and_die("wrong address (%s) length: expected %d bytes", lla, halen); | 220 | bb_error_msg_and_die("wrong address (%s) length: expected %d bytes", lla, halen); |
221 | } | 221 | } |
diff --git a/networking/libiproute/iptunnel.c b/networking/libiproute/iptunnel.c index c9fa632f3..1ec81c635 100644 --- a/networking/libiproute/iptunnel.c +++ b/networking/libiproute/iptunnel.c | |||
@@ -319,7 +319,7 @@ static void parse_args(char **argv, int cmd, struct ip_tunnel_parm *p) | |||
319 | struct ip_tunnel_parm old_p; | 319 | struct ip_tunnel_parm old_p; |
320 | memset(&old_p, 0, sizeof(old_p)); | 320 | memset(&old_p, 0, sizeof(old_p)); |
321 | if (do_get_ioctl(*argv, &old_p)) | 321 | if (do_get_ioctl(*argv, &old_p)) |
322 | exit(EXIT_FAILURE); | 322 | exit_FAILURE(); |
323 | *p = old_p; | 323 | *p = old_p; |
324 | } | 324 | } |
325 | } | 325 | } |
diff --git a/networking/ping.c b/networking/ping.c index 9805695a1..b7e6955a9 100644 --- a/networking/ping.c +++ b/networking/ping.c | |||
@@ -247,7 +247,7 @@ struct globals { | |||
247 | static void noresp(int ign UNUSED_PARAM) | 247 | static void noresp(int ign UNUSED_PARAM) |
248 | { | 248 | { |
249 | printf("No response from %s\n", G.hostname); | 249 | printf("No response from %s\n", G.hostname); |
250 | exit(EXIT_FAILURE); | 250 | exit_FAILURE(); |
251 | } | 251 | } |
252 | 252 | ||
253 | static void ping4(len_and_sockaddr *lsa) | 253 | static void ping4(len_and_sockaddr *lsa) |
diff --git a/networking/slattach.c b/networking/slattach.c index 6d2a252fc..16b4c9158 100644 --- a/networking/slattach.c +++ b/networking/slattach.c | |||
@@ -80,7 +80,7 @@ static void restore_state_and_exit(int exitcode) | |||
80 | 80 | ||
81 | /* Restore line status */ | 81 | /* Restore line status */ |
82 | if (tcsetattr_serial_or_warn(&G.saved_state)) | 82 | if (tcsetattr_serial_or_warn(&G.saved_state)) |
83 | exit(EXIT_FAILURE); | 83 | exit_FAILURE(); |
84 | 84 | ||
85 | if (ENABLE_FEATURE_CLEAN_UP) | 85 | if (ENABLE_FEATURE_CLEAN_UP) |
86 | close(serial_fd); | 86 | close(serial_fd); |
diff --git a/networking/telnetd.c b/networking/telnetd.c index 0805e464f..fb90e7f11 100644 --- a/networking/telnetd.c +++ b/networking/telnetd.c | |||
@@ -571,7 +571,7 @@ make_new_session( | |||
571 | BB_EXECVP(G.loginpath, (char **)login_argv); | 571 | BB_EXECVP(G.loginpath, (char **)login_argv); |
572 | /* _exit is safer with vfork, and we shouldn't send message | 572 | /* _exit is safer with vfork, and we shouldn't send message |
573 | * to remote clients anyway */ | 573 | * to remote clients anyway */ |
574 | _exit(EXIT_FAILURE); /*bb_perror_msg_and_die("execv %s", G.loginpath);*/ | 574 | _exit_FAILURE(); /*bb_perror_msg_and_die("execv %s", G.loginpath);*/ |
575 | } | 575 | } |
576 | 576 | ||
577 | #if ENABLE_FEATURE_TELNETD_STANDALONE | 577 | #if ENABLE_FEATURE_TELNETD_STANDALONE |