run-command: always set failed_errno in start_command
commit25043d8aea7859497c12cb035e6688f76e32ac13
authorJeff King <peff@peff.net>
Thu, 21 Mar 2013 15:45:00 +0000 (21 11:45 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 21 Mar 2013 21:06:48 +0000 (21 14:06 -0700)
tree0621e1d54279ecf24e125dd11e93201f6c9f24e2
parentc5d5c9a9a3e31b7749e1f7ddfc8825b935eda1eb
run-command: always set failed_errno in start_command

When we fail to fork, we set the failed_errno variable to
the value of errno so it is not clobbered by later syscalls.
However, we do so in a conditional, and it is hard to see
later under what conditions the variable has a valid value.

Instead of setting it only when fork fails, let's just
always set it after forking. This is more obvious for human
readers (as we are no longer setting it as a side effect of
a strerror call), and it is more obvious to gcc, which no
longer generates a spurious -Wuninitialized warning. It also
happens to match what the WIN32 half of the #ifdef does.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
run-command.c