mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-04-18 19:48:05 -05:00

Plink sets standard input into nonblocking mode, meaning that read() from fd 0 in an interactive context will typically return -1 EAGAIN. But the prompt functions in uxcons.c, used for verifying SSH host keys and suchlike, were doing an unguarded read() from fd 0, and then panicking and aborting the session when they got EAGAIN. Fixed by inventing a wrapper around read(2) which handles EAGAIN but passes all other errors back to the caller. (Seemed slightly less dangerous than the stateful alternative of temporarily re-blockifying the file descriptor.) (cherry picked from commit bea758a7ae0507e0d4a24b370f8401661cc1a2c8) Conflicts: unix/uxcons.c Cherry-picker's notes: the conflict was a trivial one. The new function block_and_read() by this commit appears just before verify_ssh_host_key(), which has a new prototype on the source branch, close enough to disrupt the patch hunk's context. Easily fixed.