Bugzilla – Attachment 3651 Details for
Bug 3523
standard output file descriptor was set with: O_NONBLOCK, but restore with flag: 0
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
restore exact flags at exit
bz3253.diff (text/plain), 2.16 KB, created by
Damien Miller
on 2023-01-17 21:30:37 AEDT
(
hide
)
Description:
restore exact flags at exit
Filename:
MIME Type:
Creator:
Damien Miller
Created:
2023-01-17 21:30:37 AEDT
Size:
2.16 KB
patch
obsolete
>diff --git a/channels.c b/channels.c >index c7b4c2a..253204f 100644 >--- a/channels.c >+++ b/channels.c >@@ -405,16 +405,19 @@ channel_register_fds(struct ssh *ssh, Channel *c, int rfd, int wfd, int efd, > */ > if (rfd != -1 && !isatty(rfd) && > (val = fcntl(rfd, F_GETFL)) != -1 && !(val & O_NONBLOCK)) { >+ c->restore_flags[0] = val; > c->restore_block |= CHANNEL_RESTORE_RFD; > set_nonblock(rfd); > } > if (wfd != -1 && !isatty(wfd) && > (val = fcntl(wfd, F_GETFL)) != -1 && !(val & O_NONBLOCK)) { >+ c->restore_flags[1] = val; > c->restore_block |= CHANNEL_RESTORE_WFD; > set_nonblock(wfd); > } > if (efd != -1 && !isatty(efd) && > (val = fcntl(efd, F_GETFL)) != -1 && !(val & O_NONBLOCK)) { >+ c->restore_flags[2] = val; > c->restore_block |= CHANNEL_RESTORE_EFD; > set_nonblock(efd); > } >@@ -498,10 +501,16 @@ channel_close_fd(struct ssh *ssh, Channel *c, int *fdp) > if (fd == -1) > return 0; > >- if ((*fdp == c->rfd && (c->restore_block & CHANNEL_RESTORE_RFD) != 0) || >- (*fdp == c->wfd && (c->restore_block & CHANNEL_RESTORE_WFD) != 0) || >- (*fdp == c->efd && (c->restore_block & CHANNEL_RESTORE_EFD) != 0)) >- (void)fcntl(*fdp, F_SETFL, 0); /* restore blocking */ >+ /* restore blocking */ >+ if (*fdp == c->rfd && >+ (c->restore_block & CHANNEL_RESTORE_RFD) != 0) >+ (void)fcntl(*fdp, F_SETFL, c->restore_flags[0]); >+ else if (*fdp == c->wfd && >+ (c->restore_block & CHANNEL_RESTORE_WFD) != 0) >+ (void)fcntl(*fdp, F_SETFL, c->restore_flags[1]); >+ else if (*fdp == c->efd && >+ (c->restore_block & CHANNEL_RESTORE_EFD) != 0) >+ (void)fcntl(*fdp, F_SETFL, c->restore_flags[2]); > > if (*fdp == c->rfd) { > c->io_want &= ~SSH_CHAN_IO_RFD; >diff --git a/channels.h b/channels.h >index 8d4699a..75efef1 100644 >--- a/channels.h >+++ b/channels.h >@@ -150,6 +150,7 @@ struct Channel { > * this way post-IO handlers are not > * accidentally called if a FD gets reused */ > int restore_block; /* fd mask to restore blocking status */ >+ int restore_flags[3];/* flags to restore */ > struct sshbuf *input; /* data read from socket, to be sent over > * encrypted connection */ > struct sshbuf *output; /* data received over encrypted connection for
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
dtucker
:
ok+
Actions:
View
|
Diff
Attachments on
bug 3523
: 3651