[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

APR patch: Win32 fixes

From: Branko Čibej <brane_at_xbc.nu>
Date: 2000-11-05 23:47:47 CET

Two nits here.

    * apr_full_read would loop infinitely if the file was smaller than
      the buffer, because read_with_timeout wouldn't return APR_EOF.
    * apr_read wouldn't read because rv wasn't initialised.
      

        * apr/file_io/win32/readwrite.c (read_with_timeout):
        Successful ReadFile with 0 bytes read indicates end-of-file.
        (apr_read): Initialise `rv' before use.

Index: readwrite.c
===================================================================
RCS file: /home/cvspublic/apache-2.0/src/lib/apr/file_io/win32/readwrite.c,v
retrieving revision 1.47
diff -u -r1.47 readwrite.c
--- readwrite.c 2000/10/16 06:04:40 1.47
+++ readwrite.c 2000/11/05 22:39:09
@@ -139,7 +139,10 @@
             rv = APR_SUCCESS; /* APR_EOF? */
         }
     } else {
- rv = APR_SUCCESS;
+ if (*nbytes == 0) /* OK and 0 bytes read ==> end of file */
+ rv = APR_EOF;
+ else
+ rv = APR_SUCCESS;
     }
     return rv;
 }
@@ -240,6 +243,7 @@
             thefile->direction = 1;
         }
 
+ rv = 0;
         while (rv == 0 && size > 0) {
             if (thefile->bufpos == APR_FILE_BUFSIZE) // write buffer is full
                 rv = apr_flush(thefile);

-- 
Brane �ibej
    home:   <brane_at_xbc.nu>             http://www.xbc.nu/brane/
    work:   <branko.cibej_at_hermes.si>   http://www.hermes-softlab.com/
     ACM:   <brane_at_acm.org>            http://www.acm.org/
Received on Sat Oct 21 14:36:14 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.