diff options
author | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2007-04-09 13:21:33 +0000 |
---|---|---|
committer | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2007-04-09 13:21:33 +0000 |
commit | bccfc5c1dd12717aeed0e46a26a0b40cb8afedcc (patch) | |
tree | 6e07b3c0349e876a6c3aee11f6a64690307d2f0b /libbb/xfuncs.c | |
parent | 68a4a5b8a86e3c0f0f371e6d3ad04cb513f10d19 (diff) | |
download | busybox-w32-bccfc5c1dd12717aeed0e46a26a0b40cb8afedcc.tar.gz busybox-w32-bccfc5c1dd12717aeed0e46a26a0b40cb8afedcc.tar.bz2 busybox-w32-bccfc5c1dd12717aeed0e46a26a0b40cb8afedcc.zip |
wait4pid: if passed with pid < 0, do not set errno - it is already set by exec!
git-svn-id: svn://busybox.net/trunk/busybox@18373 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to '')
-rw-r--r-- | libbb/xfuncs.c | 33 |
1 files changed, 0 insertions, 33 deletions
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) | |||
193 | } | 193 | } |
194 | } | 194 | } |
195 | 195 | ||
196 | // Wait for the specified child PID to exit, returning child's error return. | ||
197 | int wait4pid(int pid) | ||
198 | { | ||
199 | int status; | ||
200 | |||
201 | if (pid <= 0) { | ||
202 | errno = ECHILD; | ||
203 | return -1; | ||
204 | } | ||
205 | if (waitpid(pid, &status, 0) == -1) | ||
206 | return -1; | ||
207 | if (WIFEXITED(status)) | ||
208 | return WEXITSTATUS(status); | ||
209 | if (WIFSIGNALED(status)) | ||
210 | return WTERMSIG(status) + 10000; | ||
211 | return 0; | ||
212 | } | ||
213 | |||
214 | int wait_nohang(int *wstat) | ||
215 | { | ||
216 | return waitpid(-1, wstat, WNOHANG); | ||
217 | } | ||
218 | |||
219 | int wait_pid(int *wstat, int pid) | ||
220 | { | ||
221 | int r; | ||
222 | |||
223 | do | ||
224 | r = waitpid(pid, wstat, 0); | ||
225 | while ((r == -1) && (errno == EINTR)); | ||
226 | return r; | ||
227 | } | ||
228 | |||
229 | void sig_block(int sig) | 196 | void sig_block(int sig) |
230 | { | 197 | { |
231 | sigset_t ss; | 198 | sigset_t ss; |