diff options
author | Eric Wong <e@80x24.org> | 2017-05-16 19:25:31 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2017-05-16 19:25:31 +0000 |
commit | 5f88d79182aaabc5ea467d1d29e13e45bd2b99bf (patch) | |
tree | c54c1840780dad48a0ee9cb201b5114a8422df0a | |
parent | 09e479e911102ea9ee21a16c9e954090cbb3fc7d (diff) | |
download | git-svn-vfork-test.tar.gz |
To enable vfork, we merely have to avoid modifying memory we share with the parent, so the guard functions `child_(error|warn|die)_fn` can now be disabled. FIXME: still missing autoconf + Makefile portability tweaks. Signed-off-by: Eric Wong <e@80x24.org>
-rw-r--r-- | run-command.c | 28 |
1 files changed, 1 insertions, 27 deletions
diff --git a/run-command.c b/run-command.c index 9e36151bf9..0292dd94b6 100644 --- a/run-command.c +++ b/run-command.c @@ -324,25 +324,6 @@ static void fake_fatal(const char *err, va_list params) vreportf("fatal: ", err, params); } -static void child_error_fn(const char *err, va_list params) -{ - const char msg[] = "error() should not be called in child\n"; - xwrite(2, msg, sizeof(msg) - 1); -} - -static void child_warn_fn(const char *err, va_list params) -{ - const char msg[] = "warn() should not be called in child\n"; - xwrite(2, msg, sizeof(msg) - 1); -} - -static void NORETURN child_die_fn(const char *err, va_list params) -{ - const char msg[] = "die() should not be called in child\n"; - xwrite(2, msg, sizeof(msg) - 1); - _exit(2); -} - /* this runs in the parent process */ static void child_err_spew(struct child_process *cmd, struct child_err *cerr) { @@ -658,17 +639,10 @@ fail_pipe: * never be released in the child process. This means only * Async-Signal-Safe functions are permitted in the child. */ - cmd->pid = fork(); + cmd->pid = vfork(); failed_errno = errno; if (!cmd->pid) { int sig; - /* - * Ensure the default die/error/warn routines do not get - * called, they can take stdio locks and malloc. - */ - set_die_routine(child_die_fn); - set_error_routine(child_error_fn); - set_warn_routine(child_warn_fn); close(notify_pipe[0]); set_cloexec(notify_pipe[1]); |