diff options
Diffstat (limited to 'libbb/xfuncs_printf.c')
-rw-r--r-- | libbb/xfuncs_printf.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/libbb/xfuncs_printf.c b/libbb/xfuncs_printf.c index 73488908d..e9222f690 100644 --- a/libbb/xfuncs_printf.c +++ b/libbb/xfuncs_printf.c | |||
@@ -390,6 +390,12 @@ void FAST_FUNC xchdir(const char *path) | |||
390 | bb_perror_msg_and_die("can't change directory to '%s'", path); | 390 | bb_perror_msg_and_die("can't change directory to '%s'", path); |
391 | } | 391 | } |
392 | 392 | ||
393 | void FAST_FUNC xfchdir(int fd) | ||
394 | { | ||
395 | if (fchdir(fd)) | ||
396 | bb_perror_msg_and_die("fchdir"); | ||
397 | } | ||
398 | |||
393 | void FAST_FUNC xchroot(const char *path) | 399 | void FAST_FUNC xchroot(const char *path) |
394 | { | 400 | { |
395 | if (chroot(path)) | 401 | if (chroot(path)) |
@@ -653,3 +659,19 @@ pid_t FAST_FUNC xfork(void) | |||
653 | return pid; | 659 | return pid; |
654 | } | 660 | } |
655 | #endif | 661 | #endif |
662 | |||
663 | void FAST_FUNC xvfork_parent_waits_and_exits(void) | ||
664 | { | ||
665 | pid_t pid; | ||
666 | |||
667 | fflush_all(); | ||
668 | pid = xvfork(); | ||
669 | if (pid > 0) { | ||
670 | /* Parent */ | ||
671 | int exit_status = wait_for_exitstatus(pid); | ||
672 | if (WIFSIGNALED(exit_status)) | ||
673 | kill_myself_with_sig(WTERMSIG(exit_status)); | ||
674 | _exit(WEXITSTATUS(exit_status)); | ||
675 | } | ||
676 | /* Child continues */ | ||
677 | } | ||