summaryrefslogtreecommitdiff
path: root/contrib/persistent-https/socket.go
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2026-08-12 08:03:20 +0000
committerJunio C Hamano <gitster@pobox.com>2026-08-12 09:05:50 -0700
commit5f87f65af63a37c16d0a2c46525e92c678ef9951 (patch)
tree58dfac3c8c7461d4ad75f1e10d683d4d33c6c087 /contrib/persistent-https/socket.go
parent211ba0c0c8e4c4e1e32ccfcd3ef70781ca12a1f3 (diff)
bisect: handle dup() failure when redirecting stdout
To capture the output of each verdict command, bisect_run() temporarily redirects stdout to a temporary file via the classic dup(1) / dup2() pair, restoring it afterwards. The return value of dup(1) is not checked, however. When it fails, the saved descriptor is -1, which is then passed to close() (the issue Coverity flags), and the matching dup2() that is meant to restore stdout also fails, leaving the process with stdout still pointing at the temporary file for the remainder of the run. Treat a failed dup(1) or dup2(..., 1) as a fatal error for this bisect step: close the temporary file descriptor, report the error via error_errno(), and break out of the loop so the existing cleanup path handles the rest, just as on other failure paths in this function. Reported by Coverity as CID 1508242 ("Improper use of negative value"). Assisted-by: Opus 4.7 Helped-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/persistent-https/socket.go')
0 files changed, 0 insertions, 0 deletions