tests: drop the dead descriptor restore results

The done: block in test_SendChannelTerminalRequestNoTty() is only
entered with a descriptor still open on a path that already set an error
code, so the result checks guarding -1494 and -1495 could never be true.
Restore the descriptors and keep the original code.
pull/1273/head
John Safranek 2026-09-18 11:49:18 -07:00 committed by philljj
parent b6b4c0dafb
commit 236cc46124
1 changed files with 5 additions and 4 deletions

View File

@ -11278,14 +11278,15 @@ static int test_SendChannelTerminalRequestNoTty(void)
}
done:
/* Only reached with a descriptor still open on an already-failed path, so
* restore it but keep the original error code. Unlike the TERM block
* below, a result check here would never be true. */
if (stdinCopy >= 0) {
if (dup2(stdinCopy, STDIN_FILENO) < 0 && result == 0)
result = -1494;
(void)dup2(stdinCopy, STDIN_FILENO);
close(stdinCopy);
}
if (stdoutCopy >= 0) {
if (dup2(stdoutCopy, STDOUT_FILENO) < 0 && result == 0)
result = -1495;
(void)dup2(stdoutCopy, STDOUT_FILENO);
close(stdoutCopy);
}
if (termPinned) {