diff options
author | Brandon Williams <bmwill@google.com> | 2017-04-19 16:13:20 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-04-20 17:55:32 -0700 |
commit | e3a434468fecca7c14a6bef32050dfa60534fde6 (patch) | |
tree | ec737bb9ea936b0a8ed4fdc155ee5d8ebd91a594 /string-list.c | |
parent | 3967e25be11ab96ced71f16b9f082de270a518db (diff) | |
download | git-e3a434468fecca7c14a6bef32050dfa60534fde6.tar.gz |
run-command: use the async-signal-safe execv instead of execvp
Convert the function used to exec from 'execvp()' to 'execv()' as the (p)
variant of exec isn't async-signal-safe and has the potential to call malloc
during the path resolution it performs. Instead we simply do the path
resolution ourselves during the preparation stage prior to forking. There also
don't exist any portable (p) variants which also take in an environment to use
in the exec'd process. This allows easy migration to using 'execve()' in a
future patch.
Also, as noted in [1], in the event of an ENOEXEC the (p) variants of
exec will attempt to execute the command by interpreting it with the
'sh' utility. To maintain this functionality, if 'execv()' fails with
ENOEXEC, start_command will atempt to execute the command by
interpreting it with 'sh'.
[1] http://pubs.opengroup.org/onlinepubs/009695399/functions/exec.html
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'string-list.c')
0 files changed, 0 insertions, 0 deletions