aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2022-01-05 22:16:06 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2022-01-05 22:16:06 +0100
commitdb5546ca101846f18294a43b39883bc4ff53613a (patch)
treef8bb8a4835b70f4693dcf83edfa432c21d0ee77f /libbb
parent076f5e064fa7b6cc2c03b030abcf2cbd60514180 (diff)
downloadbusybox-w32-db5546ca101846f18294a43b39883bc4ff53613a.tar.gz
busybox-w32-db5546ca101846f18294a43b39883bc4ff53613a.tar.bz2
busybox-w32-db5546ca101846f18294a43b39883bc4ff53613a.zip
libbb: code shrink: introduce and use [_]exit_SUCCESS()
function old new delta exit_SUCCESS - 7 +7 _exit_SUCCESS - 7 +7 run_pipe 1562 1567 +5 pseudo_exec_argv 399 400 +1 finish 86 87 +1 start_stop_daemon_main 1109 1107 -2 shutdown_on_signal 38 36 -2 runsv_main 1662 1660 -2 redirect 1070 1068 -2 read_line 79 77 -2 pause_and_low_level_reboot 54 52 -2 list_i2c_busses_and_exit 483 481 -2 less_exit 12 10 -2 identify 4123 4121 -2 grep_file 1161 1159 -2 getty_main 1519 1517 -2 fsck_minix_main 2681 2679 -2 free_session 132 130 -2 fdisk_main 4739 4737 -2 clean_up_and_exit 53 51 -2 bsd_select 1566 1564 -2 bb_daemonize_or_rexec 198 196 -2 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 3/17 up/down: 21/-34) Total: -13 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r--libbb/vfork_daemon_rexec.c4
-rw-r--r--libbb/xfuncs.c10
2 files changed, 12 insertions, 2 deletions
diff --git a/libbb/vfork_daemon_rexec.c b/libbb/vfork_daemon_rexec.c
index 31e97051f..79141936a 100644
--- a/libbb/vfork_daemon_rexec.c
+++ b/libbb/vfork_daemon_rexec.c
@@ -308,7 +308,7 @@ void FAST_FUNC bb_daemonize_or_rexec(int flags, char **argv)
308 /* fflush_all(); - add it in fork_or_rexec() if necessary */ 308 /* fflush_all(); - add it in fork_or_rexec() if necessary */
309 309
310 if (fork_or_rexec(argv)) 310 if (fork_or_rexec(argv))
311 _exit(EXIT_SUCCESS); /* parent */ 311 _exit_SUCCESS(); /* parent */
312 /* if daemonizing, detach from stdio & ctty */ 312 /* if daemonizing, detach from stdio & ctty */
313 setsid(); 313 setsid();
314 dup2(fd, 0); 314 dup2(fd, 0);
@@ -320,7 +320,7 @@ void FAST_FUNC bb_daemonize_or_rexec(int flags, char **argv)
320// * Prevent this: stop being a session leader. 320// * Prevent this: stop being a session leader.
321// */ 321// */
322// if (fork_or_rexec(argv)) 322// if (fork_or_rexec(argv))
323// _exit(EXIT_SUCCESS); /* parent */ 323// _exit_SUCCESS(); /* parent */
324// } 324// }
325 } 325 }
326 while (fd > 2) { 326 while (fd > 2) {
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c
index c40dcb706..465e5366c 100644
--- a/libbb/xfuncs.c
+++ b/libbb/xfuncs.c
@@ -423,3 +423,13 @@ int FAST_FUNC wait4pid(pid_t pid)
423 return WTERMSIG(status) + 0x180; 423 return WTERMSIG(status) + 0x180;
424 return 0; 424 return 0;
425} 425}
426
427void FAST_FUNC exit_SUCCESS(void)
428{
429 exit(EXIT_SUCCESS);
430}
431
432void FAST_FUNC _exit_SUCCESS(void)
433{
434 _exit(EXIT_SUCCESS);
435}