run-command: eliminate calls to error handling functions in child
commit79319b1949f0055bd42bac7fa398fca8c2f26116
authorBrandon Williams <bmwill@google.com>
Wed, 19 Apr 2017 23:13:24 +0000 (19 16:13 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 21 Apr 2017 00:55:32 +0000 (20 17:55 -0700)
tree695dabe84317d98037f7130264485e4a6e018f1f
parentdb015a284e74b93db9184d39eb0be749e631242d
run-command: eliminate calls to error handling functions in child

All of our standard error handling paths have the potential to
call malloc or take stdio locks; so we must avoid them inside
the forked child.

Instead, the child only writes an 8 byte struct atomically to
the parent through the notification pipe to propagate an error.
All user-visible error reporting happens from the parent;
even avoiding functions like atexit(3) and exit(3).

Helped-by: Eric Wong <e@80x24.org>
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
run-command.c