Bugzilla – Attachment 3074 Details for
Bug 2797
ssh swallows end-of-file on output
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
attempt 2 - delay clobbering of stdout until after LocalCommand
bz2797.diff (text/plain), 1.05 KB, created by
Damien Miller
on 2017-10-23 11:02:54 AEDT
(
hide
)
Description:
attempt 2 - delay clobbering of stdout until after LocalCommand
Filename:
MIME Type:
Creator:
Damien Miller
Created:
2017-10-23 11:02:54 AEDT
Size:
1.05 KB
patch
obsolete
>diff --git a/ssh.c b/ssh.c >index d4c25ea..e5f9327 100644 >--- a/ssh.c >+++ b/ssh.c >@@ -1750,7 +1750,7 @@ ssh_session2_open(struct ssh *ssh) > static int > ssh_session2(struct ssh *ssh) > { >- int id = -1; >+ int devnull, id = -1; > > /* XXX should be pre-session */ > if (!options.control_persist) >@@ -1812,6 +1812,20 @@ ssh_session2(struct ssh *ssh) > options.permit_local_command) > ssh_local_cmd(options.local_command); > >+ /* >+ * stdout is now owned by the session channel; clobber it here >+ * so future channel closes are propagated to the local fd. >+ * NB. this can only happen after LocalCommand has completed, >+ * as it may want to write to stdout. >+ */ >+ if ((devnull = open(_PATH_DEVNULL, O_WRONLY)) == -1) >+ error("%s: open %s: %s", __func__, >+ _PATH_DEVNULL, strerror(errno)); >+ if (dup2(devnull, STDOUT_FILENO) < 0) >+ fatal("%s: dup2() stdout failed", __func__); >+ if (devnull > STDERR_FILENO) >+ close(devnull); >+ > /* > * If requested and we are not interested in replies to remote > * forwarding requests, then let ssh continue in the background.
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
Actions:
View
|
Diff
Attachments on
bug 2797
:
3073
| 3074