summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2001-11-14 05:58:51 +0000
committerTim Potter <tpot@samba.org>2001-11-14 05:58:51 +0000
commit641f3070ab59f5fb681ccedb692de2ef7d9d90db (patch)
tree50b1ceac5e6e8a6f3101c1a17d850099f5c278f2 /source3/libsmb
parente1f24ab6288b7f745e87c5301f7090bc73e046b0 (diff)
downloadsamba-641f3070ab59f5fb681ccedb692de2ef7d9d90db.tar.gz
samba-641f3070ab59f5fb681ccedb692de2ef7d9d90db.tar.bz2
samba-641f3070ab59f5fb681ccedb692de2ef7d9d90db.zip
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)
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/clientgen.c9
1 files changed, 9 insertions, 0 deletions
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;