• Jeff King's avatar
    run-command: always set failed_errno in start_command · 25043d8a
    Jeff King authored
    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: default avatarJeff King <peff@peff.net>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
run-command.c 16.2 KB