diff options
author | Volker Lendecke <vl@samba.org> | 2008-01-23 16:42:31 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2008-01-23 17:09:10 +0100 |
commit | a925a53f61ebdc6b4386b7c0853f2f87cbe2e166 (patch) | |
tree | 115ee6eb8c3ad08b2ef877ccda6cac49d351374c /source3/lib | |
parent | 587cf54c61c9f1f7bcae431a82035fd942716c32 (diff) | |
download | samba-a925a53f61ebdc6b4386b7c0853f2f87cbe2e166.tar.gz samba-a925a53f61ebdc6b4386b7c0853f2f87cbe2e166.tar.bz2 samba-a925a53f61ebdc6b4386b7c0853f2f87cbe2e166.zip |
read_socket_with_timeout has timeout=0 handling
(This used to be commit 7101026061c470ed962267b43ac0aa67cc761a64)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/util_sock.c | 39 |
1 files changed, 1 insertions, 38 deletions
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c index a3975f6c1f..fb8f41513b 100644 --- a/source3/lib/util_sock.c +++ b/source3/lib/util_sock.c @@ -1054,44 +1054,7 @@ ssize_t read_socket_with_timeout(int fd, ssize_t read_data(int fd,char *buffer,size_t N, enum smb_read_errors *pre) { - ssize_t ret; - size_t total=0; - char addr[INET6_ADDRSTRLEN]; - - set_smb_read_error(pre,SMB_READ_OK); - - while (total < N) { - ret = sys_read(fd,buffer + total,N - total); - - if (ret == 0) { - DEBUG(10,("read_data: read of %d returned 0. " - "Error = %s\n", - (int)(N - total), strerror(errno) )); - set_smb_read_error(pre,SMB_READ_EOF); - return 0; - } - - if (ret == -1) { - if (fd == get_client_fd()) { - /* Try and give an error message saying - * what client failed. */ - DEBUG(0,("read_data: read failure for %d " - "bytes to client %s. Error = %s\n", - (int)(N - total), - get_peer_addr(fd,addr,sizeof(addr)), - strerror(errno) )); - } else { - DEBUG(0,("read_data: read failure for %d. " - "Error = %s\n", - (int)(N - total), - strerror(errno) )); - } - set_smb_read_error(pre,SMB_READ_ERROR); - return -1; - } - total += ret; - } - return (ssize_t)total; + return read_socket_with_timeout(fd, buffer, N, N, 0, pre); } /**************************************************************************** |