diff options
author | Tim Potter <tpot@samba.org> | 2001-11-14 05:58:51 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2001-11-14 05:58:51 +0000 |
commit | bedd9c821521dad46df50e8b31e4a58bb0a9a604 (patch) | |
tree | f12c89b33b2e868e958e6c8bae5aa4af9599ec50 /source/libsmb/clientgen.c | |
parent | f07915072fef1d79549da7b92775c5aaf3c552da (diff) | |
download | samba-bedd9c821521dad46df50e8b31e4a58bb0a9a604.tar.gz samba-bedd9c821521dad46df50e8b31e4a58bb0a9a604.tar.xz samba-bedd9c821521dad46df50e8b31e4a58bb0a9a604.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().
Diffstat (limited to 'source/libsmb/clientgen.c')
-rw-r--r-- | source/libsmb/clientgen.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source/libsmb/clientgen.c b/source/libsmb/clientgen.c index d3623ad94e5..133408dff48 100644 --- a/source/libsmb/clientgen.c +++ b/source/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; |