--- samba/source/lib/util_sock.c.orig	Fri Aug 29 14:17:25 2003
+++ samba/source/lib/util_sock.c	Fri Aug 29 14:40:40 2003
@@ -216,7 +216,11 @@ ssize_t read_socket_with_timeout(int fd,
 		if (mincnt == 0) mincnt = maxcnt;
 		
 		while (nread < mincnt) {
+		#ifdef USES_RECVFROM
+			readret = sys_recvfrom(fd, buf + nread, maxcnt - nread, MSG_WAITALL, NULL, NULL);
+		#else
 			readret = sys_read(fd, buf + nread, maxcnt - nread);
+		#endif
 			
 			if (readret == 0) {
 				DEBUG(5,("read_socket_with_timeout: blocking read. EOF from client.\n"));
@@ -265,7 +269,11 @@ ssize_t read_socket_with_timeout(int fd,
 			return -1;
 		}
 		
+	#ifdef USES_RECVFROM
+		readret = sys_recvfrom(fd, buf+nread, maxcnt-nread, MSG_WAITALL, NULL, NULL);
+	#else
 		readret = sys_read(fd, buf+nread, maxcnt-nread);
+	#endif	
 		
 		if (readret == 0) {
 			/* we got EOF on the file descriptor */
@@ -300,7 +308,11 @@ ssize_t read_data(int fd,char *buffer,si
 	smb_read_error = 0;
 
 	while (total < N) {
+	#ifdef USES_RECVFROM
+		ret = sys_recvfrom(fd,buffer + total,N - total,MSG_WAITALL,NULL,NULL);
+	#else
 		ret = sys_read(fd,buffer + total,N - total);
+	#endif
 
 		if (ret == 0) {
 			DEBUG(10,("read_data: read of %d returned 0. Error = %s\n", (int)(N - total), strerror(errno) ));
@@ -330,7 +342,11 @@ static ssize_t read_socket_data(int fd,c
 	smb_read_error = 0;
 
 	while (total < N) {
+	#ifdef USES_RECVFROM
+		ret = sys_recvfrom(fd,buffer + total,N - total,MSG_WAITALL,NULL,NULL);
+	#else
 		ret = sys_read(fd,buffer + total,N - total);
+	#endif
 
 		if (ret == 0) {
 			DEBUG(10,("read_socket_data: recv of %d returned 0. Error = %s\n", (int)(N - total), strerror(errno) ));
