revert last two commits. vfork cannot be used in subroutine,

it trashes stack on return
This commit is contained in:
Denis Vlasenko
2008-07-01 15:59:42 +00:00
parent b111917972
commit 82604e9730
15 changed files with 55 additions and 50 deletions

View File

@@ -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

View File

@@ -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 */

View File

@@ -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