fflush() on readonly files

Andrey Chernov ache at nagual.pp.ru
Sat Jun 19 10:59:44 GMT 2004


On Sat, Jun 19, 2004 at 11:56:43AM +0200, Radim Kolar wrote:
> Today I have stepped on another example: advancecomp (in ports):
> 543      * Get the size of the file.
> 544      */
> 545     long fzsize(adv_fz* f)
> 546     {
> 547             if (f->type == fz_file) {
> 548                     struct stat st;
> 549                     if (fflush(f->f) != 0) {
> 550                             return -1;
> 551                     }

This program relies on undocumented behaviour and should be fixed in 
anycase. Besides of that the only reasonable approach we can take is to do 
what majority of systems does here. Since you are interested in the 
subject, please post specific table for all main systems in the form 
like:

System 		readonly fflush() behaviour

-- 
Andrey Chernov | http://ache.pp.ru/


More information about the freebsd-arch mailing list