That was fast, thank you! In the meantime I found a few more offenders,
patch below. PS: I previously sent a patch for route, which also uses
shutdown with a number, but for now I'm still waiting for comments on
that one.

Index: gnu/usr.bin/cvs/src/client.c
===================================================================
RCS file: /cvs/src/gnu/usr.bin/cvs/src/client.c,v
retrieving revision 1.13
diff -u -p -u -r1.13 client.c
--- gnu/usr.bin/cvs/src/client.c        3 Dec 2013 01:32:49 -0000       1.13
+++ gnu/usr.bin/cvs/src/client.c        20 Nov 2015 12:57:35 -0000
@@ -3586,7 +3586,7 @@ get_responses_and_close ()
 #ifdef NO_SOCKET_TO_FD
     if (use_socket_style)
     {
-       if (shutdown (server_sock, 2) < 0)
+       if (shutdown (server_sock, SHUT_RDWR) < 0)
            error (1, 0, "shutting down server socket: %s", SOCK_STRERROR
(SOCK_ERRNO));
     }
     else
@@ -3595,7 +3595,7 @@ get_responses_and_close ()
 #if defined(HAVE_KERBEROS) || defined(AUTH_CLIENT_SUPPORT)
        if (server_fd != -1)
        {
-           if (shutdown (server_fd, 1) < 0)
+           if (shutdown (server_fd, SHUT_WR) < 0)
                error (1, 0, "shutting down connection to %s: %s",
                       current_parsed_root->hostname, SOCK_STRERROR 
(SOCK_ERRNO));
            server_fd = -1;
@@ -4071,7 +4071,7 @@ connect_to_pserver (tofdp, fromfdp, veri
            else
            {
                /* Unrecognized response from server. */
-               if (shutdown (sock, 2) < 0)
+               if (shutdown (sock, SHUT_RDWR) < 0)
                {
                    error (0, 0,
                           "unrecognized auth response from %s: %s",
@@ -4091,7 +4091,7 @@ connect_to_pserver (tofdp, fromfdp, veri

     if (verify_only)
     {
-       if (shutdown (sock, 2) < 0)
+       if (shutdown (sock, SHUT_RDWR) < 0)
            error (0, 0, "shutdown() failed, server %s: %s",
current_parsed_root->hostname,
                   SOCK_STRERROR (SOCK_ERRNO));
        if (res0)
@@ -4121,7 +4121,7 @@ connect_to_pserver (tofdp, fromfdp, veri
     return;

   rejected:
-    if (shutdown (sock, 2) < 0)
+    if (shutdown (sock, SHUT_RDWR) < 0)
     {
        error (0, 0,
               "shutdown() failed (server %s): %s",
Index: gnu/usr.bin/cvs/emx/startserver.c
===================================================================
RCS file: /cvs/src/gnu/usr.bin/cvs/emx/startserver.c,v
retrieving revision 1.1.1.1
diff -u -p -u -r1.1.1.1 startserver.c
--- gnu/usr.bin/cvs/emx/startserver.c   22 Feb 1998 08:22:41 -0000      1.1.1.1
+++ gnu/usr.bin/cvs/emx/startserver.c   20 Nov 2015 12:59:27 -0000
@@ -76,7 +76,7 @@ void
 os2_shutdown_server (int fd)
 {
     /* FIXME: shutdown on files seems to have no bad effects */
-    if (shutdown (fd, 2) < 0 && errno != ENOTSOCK)
+    if (shutdown (fd, SHUT_RDWR) < 0 && errno != ENOTSOCK)
         error (1, 0, "couldn't shutdown server connection");
     if (close (fd) < 0)
         error (1, 0, "couldn't close server connection");
Index: gnu/usr.bin/cvs/windows-NT/startserver.c
===================================================================
RCS file: /cvs/src/gnu/usr.bin/cvs/windows-NT/startserver.c,v
retrieving revision 1.1.1.6
diff -u -p -u -r1.1.1.6 startserver.c
--- gnu/usr.bin/cvs/windows-NT/startserver.c    22 Aug 1998 20:55:00 -0000
1.1.1.6
+++ gnu/usr.bin/cvs/windows-NT/startserver.c    20 Nov 2015 12:59:45 -0000
@@ -71,7 +71,7 @@ wnt_shutdown_server (int fd)
        SOCKET s;

        s = fd;
-       if (shutdown (s, 2) == SOCKET_ERROR)
+       if (shutdown (s, SHUT_RDWR) == SOCKET_ERROR)
            error (1, 0, "couldn't shutdown server connection: %s",
                   SOCK_STRERROR (SOCK_ERRNO));
        if (closesocket (s) == SOCKET_ERROR)
Index: sbin/route/route.c
===================================================================
RCS file: /cvs/src/sbin/route/route.c,v
retrieving revision 1.179
diff -u -p -u -r1.179 route.c
--- sbin/route/route.c  25 Oct 2015 09:37:08 -0000      1.179
+++ sbin/route/route.c  20 Nov 2015 13:00:51 -0000
@@ -270,7 +270,7 @@ flushroutes(int argc, char **argv)

        if (uid)
                errx(1, "must be root to alter routing table");
-       shutdown(s, 0); /* Don't want to read back our messages */
+       shutdown(s, SHUT_RD); /* Don't want to read back our messages */
        while (--argc > 0) {
                if (**(++argv) == '-')
                        switch (keyword(*argv + 1)) {
@@ -450,7 +450,7 @@ newroute(int argc, char **argv)
                errx(1, "must be root to alter routing table");
        cmd = argv[0];
        if (*cmd != 'g')
-               shutdown(s, 0); /* Don't want to read back our messages */
+               shutdown(s, SHUT_RD); /* Don't want to read back our messages */
        while (--argc > 0) {
                if (**(++argv)== '-') {
                        switch (key = keyword(1 + *argv)) {

On 20/11/2015 12:44, Jérémie Courrèges-Anglas wrote:
> Ricardo Mestre <ser...@helheim.mooo.com> writes:
> 
>> Use symbolic name instead of hardcoded value on telnet(1):
> 
> Committed, thanks.
> 
>> Index: commands.c
>> ===================================================================
>> RCS file: /cvs/src/usr.bin/telnet/commands.c,v
>> retrieving revision 1.79
>> diff -u -p -u -r1.79 commands.c
>> --- commands.c       13 Nov 2015 17:04:48 -0000      1.79
>> +++ commands.c       20 Nov 2015 12:30:50 -0000
>> @@ -1192,7 +1192,7 @@ static void
>>  close_connection(void)
>>  {
>>      if (connected) {
>> -            (void) shutdown(net, 2);
>> +            (void) shutdown(net, SHUT_RDWR);
>>              printf("Connection closed.\r\n");
>>              (void)close(net);
>>              connected = 0;
>>
> 

Reply via email to