From 217e75e1520acfac863a8626a4ddb82288421ba0 Mon Sep 17 00:00:00 2001 From: Christian Ambach Date: Tue, 22 Feb 2011 15:45:44 +0100 Subject: [PATCH] s3:libsmb only log a dead connection if it was not closed 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 | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c index 33228b7a06..5a4b31d19a 100644 --- a/source3/libsmb/clientgen.c +++ b/source3/libsmb/clientgen.c @@ -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; } -- 2.34.1