diff options
author | Clemens Buchacher <drizzd@aon.at> | 2011-07-27 23:32:34 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-07-31 18:27:07 -0700 |
commit | 3bc4181fde899e02aff89f7c0a47f18d37311cb3 (patch) | |
tree | eacd31e4e1a91b6ad7fb2317b007c5203675e0e6 /run-command.c | |
parent | 2579e1d2936ad4e385ef21e5c346d9853d7faa01 (diff) | |
download | git-3bc4181fde899e02aff89f7c0a47f18d37311cb3.tar.gz |
error_routine: use parent's stderr if exec fails
The new process's error output may be redirected elsewhere, but if
the exec fails, output should still go to the parent's stderr. This
has already been done for the die_routine. Do the same for
error_routine.
Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'run-command.c')
-rw-r--r-- | run-command.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/run-command.c b/run-command.c index 70e8a249d0..5c91f37fb8 100644 --- a/run-command.c +++ b/run-command.c @@ -77,16 +77,14 @@ static void notify_parent(void) static NORETURN void die_child(const char *err, va_list params) { - char msg[4096]; - int len = vsnprintf(msg, sizeof(msg), err, params); - if (len > sizeof(msg)) - len = sizeof(msg); - - write_in_full(child_err, "fatal: ", 7); - write_in_full(child_err, msg, len); - write_in_full(child_err, "\n", 1); + vwritef(child_err, "fatal: ", err, params); exit(128); } + +static void error_child(const char *err, va_list params) +{ + vwritef(child_err, "error: ", err, params); +} #endif static inline void set_cloexec(int fd) @@ -217,6 +215,7 @@ fail_pipe: set_cloexec(child_err); } set_die_routine(die_child); + set_error_routine(error_child); close(notify_pipe[0]); set_cloexec(notify_pipe[1]); |