From: Tim Potter Date: Wed, 14 Nov 2001 05:58:51 +0000 (+0000) Subject: Close the socket and set the file descriptor to -1 if there was a socket X-Git-Tag: samba-4.0.0alpha6~801^2~16871 X-Git-Url: http://git.samba.org/samba.git/?p=ira%2Fwip.git;a=commitdiff_plain;h=641f3070ab59f5fb681ccedb692de2ef7d9d90db;ds=sidebyside 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) --- diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c index d3623ad94e5..133408dff48 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;