diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-01 15:59:42 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-01 15:59:42 +0000 |
commit | 82604e973085f91f1b99cacea08963d0d1468084 (patch) | |
tree | 2de05bb2a6943ca6be0cc46f36e5fb07099aef40 /libbb | |
parent | b111917972c1398ef96ef2d388c6c4ba57a8e9f7 (diff) |
revert last two commits. vfork cannot be used in subroutine,
it trashes stack on return
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/Kbuild | 1 | ||||
-rw-r--r-- | libbb/vfork_daemon_rexec.c | 8 | ||||
-rw-r--r-- | libbb/xvfork.c | 28 |
3 files changed, 6 insertions, 31 deletions
diff --git a/libbb/Kbuild b/libbb/Kbuild index 5ace87cad..5cbecd537 100644 --- a/libbb/Kbuild +++ b/libbb/Kbuild @@ -109,7 +109,6 @@ lib-y += xfunc_die.o lib-y += xgetcwd.o lib-y += xgethostbyname.o lib-y += xreadlink.o -lib-y += xvfork.o # conditionally compiled objects: lib-$(CONFIG_FEATURE_MOUNT_LOOP) += loop.o diff --git a/libbb/vfork_daemon_rexec.c b/libbb/vfork_daemon_rexec.c index 989e9b841..37d4c274e 100644 --- a/libbb/vfork_daemon_rexec.c +++ b/libbb/vfork_daemon_rexec.c @@ -226,7 +226,9 @@ void FAST_FUNC forkexit_or_rexec(char **argv) if (re_execed) return; - pid = xvfork(); + pid = vfork(); + if (pid < 0) /* wtf? */ + bb_perror_msg_and_die("vfork"); if (pid) /* parent */ exit(EXIT_SUCCESS); /* child - re-exec ourself */ @@ -238,7 +240,9 @@ void FAST_FUNC forkexit_or_rexec(char **argv) void FAST_FUNC forkexit_or_rexec(void) { pid_t pid; - pid = xfork(); + pid = fork(); + if (pid < 0) /* wtf? */ + bb_perror_msg_and_die("fork"); if (pid) /* parent */ exit(EXIT_SUCCESS); /* child */ diff --git a/libbb/xvfork.c b/libbb/xvfork.c deleted file mode 100644 index 3fbd0c1ed..000000000 --- a/libbb/xvfork.c +++ /dev/null @@ -1,28 +0,0 @@ -/* vi: set sw=4 ts=4: */ -/* - * Utility routines. - * - * Copyright (C) 2007 Denys Vlasenko - * - * Licensed under GPL version 2, see file LICENSE in this tarball for details. - */ - -#include "libbb.h" - -pid_t FAST_FUNC xvfork(void) -{ - pid_t pid = vfork(); - if (pid < 0) - bb_perror_msg_and_die("vfork"); - return pid; -} - -#if BB_MMU -pid_t FAST_FUNC xfork(void) -{ - pid_t pid = fork(); - if (pid < 0) - bb_perror_msg_and_die("vfork" + 1); - return pid; -} -#endif |