apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian Havard" <bri...@kheldar.apana.org.au>
Subject Re: cvs commit: apr/test testfileinfo.c
Date Thu, 13 Feb 2003 11:24:10 GMT
On Tue, 11 Feb 2003 23:01:48 +0100, Branko Ä ibej wrote:

>Joe Orton wrote:
>>--- filestat.c	7 Jan 2003 00:52:53 -0000	1.64
>>+++ filestat.c	11 Feb 2003 18:19:12 -0000
>>@@ -135,6 +135,8 @@
>>         finfo->pool = thefile->pool;
>>         finfo->fname = thefile->fname;
>>         fill_out_finfo(finfo, &info, wanted);
>>+        if (thefile->buffered)
>>+            finfo->size += thefile->bufpos;
>>         return (wanted & ~finfo->valid) ? APR_INCOMPLETE : APR_SUCCESS;
>>     }
>>     else {
>>  
>>
>
>Hmm, does this patch actually work? I suspect the calculation would be
>slightly more involved -- after all, the buffer might not extend past
>the hard end-of-file at all.

And the buffer might contain read data, not written. This is the patch I'm 
considering for the OS/2 code, it passes the File Info test:

Index: filestat.c
===================================================================
RCS file: /home/cvs/apr/file_io/os2/filestat.c,v
retrieving revision 1.34
diff -u -r1.34 filestat.c
--- filestat.c	7 Jan 2003 00:52:51 -0000	1.34
+++ filestat.c	13 Feb 2003 10:20:08 -0000
@@ -141,6 +141,12 @@
 
         if (finfo->filetype == APR_REG) {
             if (thefile->isopen) {
+                if (thefile->buffered && thefile->direction == 1) {
+                    if (thefile->filePtr + thefile->bufpos > finfo->size) {
+                        finfo->size = thefile->filePtr + thefile->bufpos;
+                    }
+                }
+
                 return handle_type(&finfo->filetype, thefile->filedes);
             }
         } else {

-- 
 ______________________________________________________________________________
 |  Brian Havard                 |  "He is not the messiah!                   |
 |  brianh@kheldar.apana.org.au  |  He's a very naughty boy!" - Life of Brian |
 ------------------------------------------------------------------------------


Mime
View raw message