diff options
author | Jeremy Allison <jra@samba.org> | 2002-10-01 06:50:25 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2002-10-01 06:50:25 +0000 |
commit | 5567ef53cb65e6100825ea909d9c35e322e65293 (patch) | |
tree | 18684eca781cac862db23cb81301208650ce6df2 /source3/libsmb/clierror.c | |
parent | a9ccc38c082c3c74050cbbf554cbef027e585fdd (diff) | |
download | samba-5567ef53cb65e6100825ea909d9c35e322e65293.tar.gz samba-5567ef53cb65e6100825ea909d9c35e322e65293.tar.bz2 samba-5567ef53cb65e6100825ea909d9c35e322e65293.zip |
Cope with rw errors and timeout to peer.
Jeremy.
(This used to be commit 736a7bab487d7e217eed452e2089adb6b4164ad5)
Diffstat (limited to 'source3/libsmb/clierror.c')
-rw-r--r-- | source3/libsmb/clierror.c | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/source3/libsmb/clierror.c b/source3/libsmb/clierror.c index fb88b66786..f5281eb047 100644 --- a/source3/libsmb/clierror.c +++ b/source3/libsmb/clierror.c @@ -85,11 +85,31 @@ char *cli_errstr(struct cli_state *cli) return cli_error_message; } - /* Was it server timeout ? */ - if (cli->fd == -1 && cli->timeout > 0 && cli->smb_read_error == READ_TIMEOUT) { - slprintf(cli_error_message, sizeof(cli_error_message) - 1, - "Call timed out: server did not respond after %d milliseconds", - cli->timeout); + /* Was it server socket error ? */ + if (cli->fd == -1 && cli->smb_rw_error) { + switch(cli->smb_rw_error) { + case READ_TIMEOUT: + slprintf(cli_error_message, sizeof(cli_error_message) - 1, + "Call timed out: server did not respond after %d milliseconds", + cli->timeout); + break; + case READ_EOF: + slprintf(cli_error_message, sizeof(cli_error_message) - 1, + "Call returned zero bytes (EOF)\n" ); + break; + case READ_ERROR: + slprintf(cli_error_message, sizeof(cli_error_message) - 1, + "Read error: %s\n", strerror(errno) ); + break; + case WRITE_ERROR: + slprintf(cli_error_message, sizeof(cli_error_message) - 1, + "Write error: %s\n", strerror(errno) ); + break; + default: + slprintf(cli_error_message, sizeof(cli_error_message) - 1, + "Unknown error code %d\n", cli->smb_rw_error ); + break; + } return cli_error_message; } |