From 641f3070ab59f5fb681ccedb692de2ef7d9d90db Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 14 Nov 2001 05:58:51 +0000 Subject: Close the socket and set the file descriptor to -1 if there was a socket error in cli_receive_smb() and cli_send_smb(). (This used to be commit bedd9c821521dad46df50e8b31e4a58bb0a9a604) --- source3/libsmb/clientgen.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source3/libsmb/clientgen.c') diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c index d3623ad94e..133408dff4 100644 --- a/source3/libsmb/clientgen.c +++ b/source3/libsmb/clientgen.c @@ -58,6 +58,13 @@ BOOL cli_receive_smb(struct cli_state *cli) } } + /* If the server is not responding, note that now */ + + if (!ret) { + close(cli->fd); + cli->fd = -1; + } + return ret; } @@ -76,6 +83,8 @@ BOOL cli_send_smb(struct cli_state *cli) while (nwritten < len) { ret = write_socket(cli->fd,cli->outbuf+nwritten,len - nwritten); if (ret <= 0) { + close(cli->fd); + cli->fd = -1; DEBUG(0,("Error writing %d bytes to client. %d\n", (int)len,(int)ret)); return False; -- cgit