summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/serverloop.c
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>1999-10-03 19:17:41 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>1999-10-03 19:17:41 +0000
commit1b165e9f2c3ac4fe5316adc1ee1b63e78a3fbd55 (patch)
treeb7c3e939195ea8faa3b53641300ccfeea10329d0 /usr.bin/ssh/serverloop.c
parent7303fe65db58e3b9f040a92ae0d9a47bd6447445 (diff)
do not call shutdown() on pipes, ok: deraadt
Diffstat (limited to 'usr.bin/ssh/serverloop.c')
-rw-r--r--usr.bin/ssh/serverloop.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/usr.bin/ssh/serverloop.c b/usr.bin/ssh/serverloop.c
index 5ce73db9da7..5fa749dceab 100644
--- a/usr.bin/ssh/serverloop.c
+++ b/usr.bin/ssh/serverloop.c
@@ -357,7 +357,11 @@ void process_output(fd_set *writeset)
buffer_len(&stdin_buffer));
if (len <= 0)
{
+#ifdef USE_PIPES
+ close(fdin);
+#else
shutdown(fdin, 1); /* We will no longer send. */
+#endif
fdin = -1;
}
else
@@ -477,7 +481,11 @@ void server_loop(int pid, int fdin_arg, int fdout_arg, int fderr_arg)
cause a real eof by closing fdin. */
if (stdin_eof && fdin != -1 && buffer_len(&stdin_buffer) == 0)
{
+#ifdef USE_PIPES
+ close(fdin);
+#else
shutdown(fdin, 1); /* We will no longer send. */
+#endif
fdin = -1;
}
@@ -555,15 +563,27 @@ void server_loop(int pid, int fdin_arg, int fdout_arg, int fderr_arg)
/* Close the file descriptors. */
if (fdout != -1)
+#ifdef USE_PIPES
+ close(fdout);
+#else
shutdown(fdout, 0);
+#endif
fdout = -1;
fdout_eof = 1;
if (fderr != -1)
+#ifdef USE_PIPES
+ close(fderr);
+#else
shutdown(fderr, 0);
+#endif
fderr = -1;
fderr_eof = 1;
if (fdin != -1)
+#ifdef USE_PIPES
+ close(fdin);
+#else
shutdown(fdin, 1);
+#endif
fdin = -1;
/* Stop listening for channels; this removes unix domain sockets. */