diff options
author | djm@openbsd.org <djm@openbsd.org> | 2021-05-19 01:24:05 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2021-05-19 11:52:14 +1000 |
commit | 7be4ac813662f68e89f23c50de058a49aa32f7e4 (patch) | |
tree | 7040d1e4601e2a0545e20614e96d8d818eccbf35 /.github | |
parent | c4902e1a653c67fea850ec99c7537f358904c0af (diff) |
upstream: restore blocking status on stdio fds before close
ssh(1) needs to set file descriptors to non-blocking mode to operate
but it was not restoring the original state on exit. This could cause
problems with fds shared with other programs via the shell, e.g.
> $ cat > test.sh << _EOF
> #!/bin/sh
> {
> ssh -Fnone -oLogLevel=verbose ::1 hostname
> cat /usr/share/dict/words
> } | sleep 10
> _EOF
> $ ./test.sh
> Authenticated to ::1 ([::1]:22).
> Transferred: sent 2352, received 2928 bytes, in 0.1 seconds
> Bytes per second: sent 44338.9, received 55197.4
> cat: stdout: Resource temporarily unavailable
This restores the blocking status for fds 0,1,2 (stdio) before ssh(1)
abandons/closes them.
This was reported as bz3280 and GHPR246; ok dtucker@
OpenBSD-Commit-ID: 8cc67346f05aa85a598bddf2383fcfcc3aae61ce
Diffstat (limited to '.github')
0 files changed, 0 insertions, 0 deletions