s3:libsmb only log a dead connection if it was not closed
authorChristian Ambach <christian.ambach@de.ibm.com>
Tue, 22 Feb 2011 14:45:44 +0000 (15:45 +0100)
committerVolker Lendecke <vl@samba.org>
Wed, 2 Mar 2011 10:03:41 +0000 (03:03 -0700)
in case the cli was closed before (e.g. via a dropped ip message)
it can be expected that the read here returns with an error and so
we should not log that a connection is dead when it was closed before

source3/libsmb/clientgen.c

index 33228b7a06e96182fdb2d989a9f4f321289db604..5a4b31d19ad0a61707a3c1aa744aaa77681b974d 100644 (file)
@@ -171,13 +171,18 @@ bool cli_receive_smb(struct cli_state *cli)
 
        /* If the server is not responding, note that now */
        if (len < 0) {
-               char addr[INET6_ADDRSTRLEN];
-
-               print_sockaddr(addr, sizeof(addr), &cli->dest_ss);
-                DEBUG(0, ("Receiving SMB: Server %s stopped responding\n",
-                         addr));
-               close(cli->fd);
-               cli->fd = -1;
+               /*
+                * only log if the connection should still be open and not when
+                * the connection was closed due to a dropped ip message
+                */
+               if (cli->fd != -1) {
+                       char addr[INET6_ADDRSTRLEN];
+                       print_sockaddr(addr, sizeof(addr), &cli->dest_ss);
+                       DEBUG(0, ("Receiving SMB: Server %s stopped responding\n",
+                               addr));
+                       close(cli->fd);
+                       cli->fd = -1;
+               }
                return false;
        }