]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
restore tty force-read hack
authorDamien Miller <djm@mindrot.org>
Sat, 22 Jan 2022 00:38:21 +0000 (11:38 +1100)
committerDamien Miller <djm@mindrot.org>
Sat, 22 Jan 2022 00:38:21 +0000 (11:38 +1100)
This portable-specific hack fixes a hang on exit for ttyful sessions
on Linux and some SysVish Unix variants. It was accidentally disabled
in commit 5c79952dfe1a (a precursor to the mainloop poll(2) conversion).

Spotted by John in bz3383

channels.c

index 8281e5d3b850cd3615029de5c04ec77b0589127c..dbfec7c00dcea1e6ca16dc3266740052d56d425e 100644 (file)
@@ -1922,7 +1922,7 @@ channel_handle_rfd(struct ssh *ssh, Channel *c)
 
        force = c->isatty && c->detach_close && c->istate != CHAN_INPUT_CLOSED;
 
-       if ((c->io_ready & SSH_CHAN_IO_RFD) == 0)
+       if (!force && (c->io_ready & SSH_CHAN_IO_RFD) == 0)
                return 1;
 
        errno = 0;
@@ -2087,7 +2087,7 @@ channel_handle_efd_read(struct ssh *ssh, Channel *c)
 
        force = c->isatty && c->detach_close && c->istate != CHAN_INPUT_CLOSED;
 
-       if ((c->io_ready & SSH_CHAN_IO_EFD_R) == 0)
+       if (!force && (c->io_ready & SSH_CHAN_IO_EFD_R) == 0)
                return 1;
 
        len = read(c->efd, buf, sizeof(buf));