diff options
author | 1999-10-04 21:54:40 +0000 | |
---|---|---|
committer | 1999-10-04 21:54:40 +0000 | |
commit | fa5f6d14c7e56f53623fef0cba8fe7f2402a276f (patch) | |
tree | 4ddf8d9ee906cfa4b4b8eaa6208ea58de98930fd /usr.bin/ssh/serverloop.c | |
parent | Synch with current development: (diff) | |
download | wireguard-openbsd-fa5f6d14c7e56f53623fef0cba8fe7f2402a276f.tar.xz wireguard-openbsd-fa5f6d14c7e56f53623fef0cba8fe7f2402a276f.zip |
fix shutdown() for sockets, the last one has to close the socket
Diffstat (limited to 'usr.bin/ssh/serverloop.c')
-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. */ |