summaryrefslogtreecommitdiff
path: root/libbb/xfuncs.c
diff options
context:
space:
mode:
authorDenis Vlasenko2007-03-26 17:25:33 +0000
committerDenis Vlasenko2007-03-26 17:25:33 +0000
commitafa7023b465d2abc5a85ecba0917cae974257eaf (patch)
tree8c8cc570f93e83a6a38f2b184d83cd7f2fa9985e /libbb/xfuncs.c
parent4e1361a4819ad0fcf76e161bfdcdc8bc29c872ff (diff)
downloadbusybox-afa7023b465d2abc5a85ecba0917cae974257eaf.zip
busybox-afa7023b465d2abc5a85ecba0917cae974257eaf.tar.gz
zcip: make it work on NOMMU (+ improve NOMMU support machinery)
fsck: fix bad English in a comment
Diffstat (limited to 'libbb/xfuncs.c')
-rw-r--r--libbb/xfuncs.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c
index 14bd62a..7f870ac 100644
--- a/libbb/xfuncs.c
+++ b/libbb/xfuncs.c
@@ -192,9 +192,16 @@ int wait4pid(int pid)
{
int status;
- if (pid == -1 || waitpid(pid, &status, 0) == -1) return -1;
- if (WIFEXITED(status)) return WEXITSTATUS(status);
- if (WIFSIGNALED(status)) return WTERMSIG(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;
}