Bugzilla – Attachment 3073 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]
transfer stdout to channel
bz2797.diff (text/plain), 1.01 KB, created by
Damien Miller
on 2017-10-23 10:04:32 AEDT
(
hide
)
Description:
transfer stdout to channel
Filename:
MIME Type:
Creator:
Damien Miller
Created:
2017-10-23 10:04:32 AEDT
Size:
1.01 KB
patch
obsolete
>diff --git a/ssh.c b/ssh.c >index d4c25ea..cd9ab25 100644 >--- a/ssh.c >+++ b/ssh.c >@@ -1705,18 +1705,31 @@ static int > ssh_session2_open(struct ssh *ssh) > { > Channel *c; >- int window, packetmax, in, out, err; >+ int window, packetmax, in, out, err, devnull; >+ >+ if ((devnull = open(_PATH_DEVNULL, O_RDWR)) == -1) >+ error("%s: open %s: %s", __func__, >+ _PATH_DEVNULL, strerror(errno)); > > if (stdin_null_flag) { >- in = open(_PATH_DEVNULL, O_RDONLY); >+ in = dup(devnull); > } else { > in = dup(STDIN_FILENO); > } > out = dup(STDOUT_FILENO); > err = dup(STDERR_FILENO); > >+ /* >+ * stdout will henceforth be owned by the channel; clobber it here >+ * so channel closes are propagated to the local fd. >+ */ >+ if (dup2(devnull, STDOUT_FILENO) < 0) >+ fatal("%s: dup2() stdout failed", __func__); >+ > if (in < 0 || out < 0 || err < 0) >- fatal("dup() in/out/err failed"); >+ fatal("%s: dup() in/out/err failed", __func__); >+ if (devnull > STDERR_FILENO) >+ close(devnull); > > /* enable nonblocking unless tty */ > if (!isatty(in))
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