diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 1999-10-04 21:54:41 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 1999-10-04 21:54:41 +0000 |
commit | 0d467f93c51e79228cc9f9f2baa0783f776f9db4 (patch) | |
tree | 2f8ff2663a45a2ef3b05568f6681e18dbf0a6053 /usr.bin | |
parent | 5dfe2b009511b15f852b0bc0512140ae1e9371a3 (diff) |
fix shutdown() for sockets, the last one has to close the socket
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/ssh/serverloop.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/usr.bin/ssh/serverloop.c b/usr.bin/ssh/serverloop.c index 0545b04747d..552c69c2952 100644 --- a/usr.bin/ssh/serverloop.c +++ b/usr.bin/ssh/serverloop.c @@ -362,7 +362,10 @@ void process_output(fd_set *writeset) #ifdef USE_PIPES close(fdin); #else - shutdown(fdin, SHUT_WR); /* We will no longer send. */ + if (fdout == -1) + close(fdin); + else + shutdown(fdin, SHUT_WR); /* We will no longer send. */ #endif fdin = -1; } @@ -486,7 +489,10 @@ void server_loop(int pid, int fdin_arg, int fdout_arg, int fderr_arg) #ifdef USE_PIPES close(fdin); #else - shutdown(fdin, SHUT_WR); /* We will no longer send. */ + if (fdout == -1) + close(fdin); + else + shutdown(fdin, SHUT_WR); /* We will no longer send. */ #endif fdin = -1; } @@ -565,27 +571,15 @@ 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, SHUT_RD); -#endif fdout = -1; fdout_eof = 1; if (fderr != -1) -#ifdef USE_PIPES close(fderr); -#else - shutdown(fderr, SHUT_RD); -#endif fderr = -1; fderr_eof = 1; if (fdin != -1) -#ifdef USE_PIPES close(fdin); -#else - shutdown(fdin, SHUT_WR); -#endif fdin = -1; /* Stop listening for channels; this removes unix domain sockets. */ |