From 53d445aa7571c780b8f2410afb4f326e45f851e4 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Mon, 9 Apr 2007 13:21:33 +0000 Subject: wait4pid: if passed with pid < 0, do not set errno - it is already set by exec! --- libbb/xfuncs.c | 33 --------------------------------- 1 file changed, 33 deletions(-) (limited to 'libbb/xfuncs.c') diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c index c18a1d998..0cf2005ac 100644 --- a/libbb/xfuncs.c +++ b/libbb/xfuncs.c @@ -193,39 +193,6 @@ void xfflush_stdout(void) } } -// Wait for the specified child PID to exit, returning child's error return. -int wait4pid(int pid) -{ - int status; - - if (pid <= 0) { - errno = ECHILD; - return -1; - } - if (waitpid(pid, &status, 0) == -1) - return -1; - if (WIFEXITED(status)) - return WEXITSTATUS(status); - if (WIFSIGNALED(status)) - return WTERMSIG(status) + 10000; - return 0; -} - -int wait_nohang(int *wstat) -{ - return waitpid(-1, wstat, WNOHANG); -} - -int wait_pid(int *wstat, int pid) -{ - int r; - - do - r = waitpid(pid, wstat, 0); - while ((r == -1) && (errno == EINTR)); - return r; -} - void sig_block(int sig) { sigset_t ss; -- cgit v1.2.3