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) | |
| download | busybox-w32-82604e973085f91f1b99cacea08963d0d1468084.tar.gz busybox-w32-82604e973085f91f1b99cacea08963d0d1468084.tar.bz2 busybox-w32-82604e973085f91f1b99cacea08963d0d1468084.zip | |
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 | |||
| 109 | lib-y += xgetcwd.o | 109 | lib-y += xgetcwd.o |
| 110 | lib-y += xgethostbyname.o | 110 | lib-y += xgethostbyname.o |
| 111 | lib-y += xreadlink.o | 111 | lib-y += xreadlink.o |
| 112 | lib-y += xvfork.o | ||
| 113 | 112 | ||
| 114 | # conditionally compiled objects: | 113 | # conditionally compiled objects: |
| 115 | lib-$(CONFIG_FEATURE_MOUNT_LOOP) += loop.o | 114 | 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) | |||
| 226 | if (re_execed) | 226 | if (re_execed) |
| 227 | return; | 227 | return; |
| 228 | 228 | ||
| 229 | pid = xvfork(); | 229 | pid = vfork(); |
| 230 | if (pid < 0) /* wtf? */ | ||
| 231 | bb_perror_msg_and_die("vfork"); | ||
| 230 | if (pid) /* parent */ | 232 | if (pid) /* parent */ |
| 231 | exit(EXIT_SUCCESS); | 233 | exit(EXIT_SUCCESS); |
| 232 | /* child - re-exec ourself */ | 234 | /* child - re-exec ourself */ |
| @@ -238,7 +240,9 @@ void FAST_FUNC forkexit_or_rexec(char **argv) | |||
| 238 | void FAST_FUNC forkexit_or_rexec(void) | 240 | void FAST_FUNC forkexit_or_rexec(void) |
| 239 | { | 241 | { |
| 240 | pid_t pid; | 242 | pid_t pid; |
| 241 | pid = xfork(); | 243 | pid = fork(); |
| 244 | if (pid < 0) /* wtf? */ | ||
| 245 | bb_perror_msg_and_die("fork"); | ||
| 242 | if (pid) /* parent */ | 246 | if (pid) /* parent */ |
| 243 | exit(EXIT_SUCCESS); | 247 | exit(EXIT_SUCCESS); |
| 244 | /* child */ | 248 | /* 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 @@ | |||
| 1 | /* vi: set sw=4 ts=4: */ | ||
| 2 | /* | ||
| 3 | * Utility routines. | ||
| 4 | * | ||
| 5 | * Copyright (C) 2007 Denys Vlasenko | ||
| 6 | * | ||
| 7 | * Licensed under GPL version 2, see file LICENSE in this tarball for details. | ||
| 8 | */ | ||
| 9 | |||
| 10 | #include "libbb.h" | ||
| 11 | |||
| 12 | pid_t FAST_FUNC xvfork(void) | ||
| 13 | { | ||
| 14 | pid_t pid = vfork(); | ||
| 15 | if (pid < 0) | ||
| 16 | bb_perror_msg_and_die("vfork"); | ||
| 17 | return pid; | ||
| 18 | } | ||
| 19 | |||
| 20 | #if BB_MMU | ||
| 21 | pid_t FAST_FUNC xfork(void) | ||
| 22 | { | ||
| 23 | pid_t pid = fork(); | ||
| 24 | if (pid < 0) | ||
| 25 | bb_perror_msg_and_die("vfork" + 1); | ||
| 26 | return pid; | ||
| 27 | } | ||
| 28 | #endif | ||
