summaryrefslogtreecommitdiff
path: root/libbb/xfuncs_printf.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/xfuncs_printf.c')
-rw-r--r--libbb/xfuncs_printf.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/libbb/xfuncs_printf.c b/libbb/xfuncs_printf.c
index 4aa1b5c..e9222f6 100644
--- a/libbb/xfuncs_printf.c
+++ b/libbb/xfuncs_printf.c
@@ -659,3 +659,19 @@ pid_t FAST_FUNC xfork(void)
return pid;
}
#endif
+
+void FAST_FUNC xvfork_parent_waits_and_exits(void)
+{
+ pid_t pid;
+
+ fflush_all();
+ pid = xvfork();
+ if (pid > 0) {
+ /* Parent */
+ int exit_status = wait_for_exitstatus(pid);
+ if (WIFSIGNALED(exit_status))
+ kill_myself_with_sig(WTERMSIG(exit_status));
+ _exit(WEXITSTATUS(exit_status));
+ }
+ /* Child continues */
+}