apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Branko Čibej <br...@xbc.nu>
Subject Re: cvs commit: apr/test testfileinfo.c
Date Sat, 08 Feb 2003 01:21:28 GMT
Joe Orton wrote:

>On Mon, Feb 03, 2003 at 11:51:56PM -0000, Branko �ibej wrote:
>  
>
>>brane       2003/02/03 15:51:56
>>
>>  Modified:    test     testfileinfo.c
>>  Log:
>>  Added a new test to check the behaviour of apr_file_info_get in
>>  combination with buffered writes. At the moment, this test will
>>  probably fail on all plaforms.
>>    
>>
>
>It does indeed, is this the kind of fix you were thinking of?
>
I expect that change would avoid the problem, yes. (In fact, in
Subversion, I did an explicit fluxh befode calling apr_file_info_get,
for this very reason.) I was sort of hoping someone had a better idea
for a fix, though; forcing a flush before every stat seems to me to
defeat the whole purpose of buffering.

>Index: filestat.c
>===================================================================
>RCS file: /home/cvs/apr/file_io/unix/filestat.c,v
>retrieving revision 1.64
>diff -u -r1.64 filestat.c
>--- filestat.c	7 Jan 2003 00:52:53 -0000	1.64
>+++ filestat.c	7 Feb 2003 12:36:01 -0000
>@@ -131,6 +131,13 @@
> {
>     struct stat info;
> 
>+    if (thefile->buffered) {
>+        apr_status_t rv = apr_file_flush(thefile);
>+        
>+        if (rv != APR_SUCCESS)
>+            return rv;
>+    }
>+
>     if (fstat(thefile->filedes, &info) == 0) {
>         finfo->pool = thefile->pool;
>         finfo->fname = thefile->fname;
>  
>

-- 
Brane Čibej   <brane@xbc.nu>   http://www.xbc.nu/brane/


Mime
View raw message