aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorvda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2007-03-26 17:25:33 +0000
committervda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2007-03-26 17:25:33 +0000
commitfe8d1db385d1de65c0f28db4c0ee7a430b0b959f (patch)
tree8c8cc570f93e83a6a38f2b184d83cd7f2fa9985e /libbb
parenta30c46a71aad82df94777af890e8f252b4b344ab (diff)
downloadbusybox-w32-fe8d1db385d1de65c0f28db4c0ee7a430b0b959f.tar.gz
busybox-w32-fe8d1db385d1de65c0f28db4c0ee7a430b0b959f.tar.bz2
busybox-w32-fe8d1db385d1de65c0f28db4c0ee7a430b0b959f.zip
zcip: make it work on NOMMU (+ improve NOMMU support machinery)
fsck: fix bad English in a comment git-svn-id: svn://busybox.net/trunk/busybox@18248 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'libbb')
-rw-r--r--libbb/vfork_daemon_rexec.c9
-rw-r--r--libbb/xfuncs.c13
2 files changed, 16 insertions, 6 deletions
diff --git a/libbb/vfork_daemon_rexec.c b/libbb/vfork_daemon_rexec.c
index 89ae9a73c..ec8b9b1d7 100644
--- a/libbb/vfork_daemon_rexec.c
+++ b/libbb/vfork_daemon_rexec.c
@@ -40,11 +40,14 @@ pid_t spawn(char **argv)
40 * (but don't run atexit() stuff, which would screw up parent.) 40 * (but don't run atexit() stuff, which would screw up parent.)
41 */ 41 */
42 failed = errno; 42 failed = errno;
43 _exit(0); 43 _exit(111);
44 } 44 }
45 /* parent */ 45 /* parent */
46 /* Unfortunately, this is not reliable: vfork() 46 /* Unfortunately, this is not reliable: according to standards
47 * can be equivalent to fork() according to standards */ 47 * vfork() can be equivalent to fork() and we won't see value
48 * of 'failed'.
49 * Interested party can wait on pid and learn exit code.
50 * If 111 - then it (most probably) failed to exec */
48 if (failed) { 51 if (failed) {
49 errno = failed; 52 errno = failed;
50 return -1; 53 return -1;
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c
index 14bd62a15..7f870ac8b 100644
--- a/libbb/xfuncs.c
+++ b/libbb/xfuncs.c
@@ -192,9 +192,16 @@ int wait4pid(int pid)
192{ 192{
193 int status; 193 int status;
194 194
195 if (pid == -1 || waitpid(pid, &status, 0) == -1) return -1; 195 if (pid <= 0) {
196 if (WIFEXITED(status)) return WEXITSTATUS(status); 196 errno = ECHILD;
197 if (WIFSIGNALED(status)) return WTERMSIG(status); 197 return -1;
198 }
199 if (waitpid(pid, &status, 0) == -1)
200 return -1;
201 if (WIFEXITED(status))
202 return WEXITSTATUS(status);
203 if (WIFSIGNALED(status))
204 return WTERMSIG(status) + 10000;
198 return 0; 205 return 0;
199} 206}
200 207