[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-gnulib] closeout doesn't always close: which is better: always
From: |
Bruno Haible |
Subject: |
Re: [Bug-gnulib] closeout doesn't always close: which is better: always or never? |
Date: |
Sat, 6 Nov 2004 19:54:17 +0100 |
User-agent: |
KMail/1.5 |
Jim Meyering wrote:
> Is there any reason to call fclose rather than just fflush?
In Linux, at least (see linux/fs/open.c), close() can return an error if
the file system dependent f_op->flush function fails. close() is the only
system call to use f_op->flush; therefore on file systems that have a
'flush' operation (NFS and Coda) close() can fail even when the previous
write() system calls from fflush() have succeeded. The obvious reason is
that for these filesystems, there OS maintains a cache into which write()
writes, and this cache is not emptied until close().
Bruno