• J
    start_command(), if .in/.out > 0, closes file descriptors, not the callers · c20181e3
    Johannes Sixt 提交于
    Callers of start_command() can set the members .in and .out of struct
    child_process to a value > 0 to specify that this descriptor is used as
    the stdin or stdout of the child process.
    
    Previously, if start_command() was successful, this descriptor was closed
    upon return. Here we now make sure that the descriptor is also closed in
    case of failures. All callers are updated not to close the file descriptor
    themselves after start_command() was called.
    
    Note that earlier run_gpg_verify() of git-verify-tag set .out = 1, which
    worked because start_command() treated this as a special case, but now
    this is incorrect because it closes the descriptor. The intent here is to
    inherit stdout to the child, which is achieved by .out = 0.
    Signed-off-by: NJohannes Sixt <johannes.sixt@telecom.at>
    Signed-off-by: NJunio C Hamano <gitster@pobox.com>
    c20181e3
run-command.c 4.8 KB