r24629: Make read_sock return the total number of bytes read instead
authorMichael Adam <obnox@samba.org>
Wed, 22 Aug 2007 13:51:44 +0000 (13:51 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 20:02:26 +0000 (15:02 -0500)
of the number of bytes read in the last of possibly several
read calls.

This was noted by Metze.

Michael

source/nsswitch/wb_common.c

index e2b84e9f69392bc2373cbdd40e5d0ec21708ea7b..e8ea31db0fc9d2b3c46106ff94c985ae71dc131f 100644 (file)
@@ -421,7 +421,7 @@ int write_sock(void *buffer, int count)
 
 static int read_sock(void *buffer, int count)
 {
 
 static int read_sock(void *buffer, int count)
 {
-       int result = 0, nread = 0;
+       int nread = 0;
        int total_time = 0, selret;
 
        /* Read data from socket */
        int total_time = 0, selret;
 
        /* Read data from socket */
@@ -458,7 +458,7 @@ static int read_sock(void *buffer, int count)
                        
                        /* Do the Read */
                        
                        
                        /* Do the Read */
                        
-                       result = read(winbindd_fd, (char *)buffer + nread, 
+                       int result = read(winbindd_fd, (char *)buffer + nread, 
                              count - nread);
                        
                        if ((result == -1) || (result == 0)) {
                              count - nread);
                        
                        if ((result == -1) || (result == 0)) {
@@ -476,7 +476,7 @@ static int read_sock(void *buffer, int count)
                }
        }
        
                }
        }
        
-       return result;
+       return nread;
 }
 
 /* Read reply */
 }
 
 /* Read reply */