[BusyBox] Re: ifconfig: Clean up. [PATCH]

Rainer Weikusat rainer.weikusat at sncag.com
Wed Jul 27 09:29:46 UTC 2005


Bernd Petrovitsch <bernd at firmix.at> writes:

> On Wed, 2005-07-27 at 10:03 +1000, Glenn L. McGrath wrote:
> [...]
>> We should be closing and checking the return value of close. I was going
>> to jump on this problem at one time for the archiving code, but i never
>> got around to it.
>> 
>> >From man close(2)
>> 
>> "Not checking the return value of close is  a  common  but  nevertheless
>> serious  programming error.  It is quite possible that errors on a
>> previous write(2) operation are first reported at the  final  close.  
>> Not checking the return value when closing the file may lead to silent
>> loss of data.  This can especially be observed with NFS and with disk
>> quota."
>
> The foolowing patch wasn't accepted, though
> http://www.cs.helsinki.fi/linux/linux-kernel/2002-11/0955.html
>
> And AFAIK this hasn't changed afterwards in the Linux kernel.
>
> The issue was also mentioned on
> http://lwn.net/2002/0328/kernel.php3.

Quoting from there:

	Not everybody agrees that this is the right thing to do,
	interestingly. It has been stated that the fsync() call should
	be used by applications which are interested in any
	last-minute errors.

And this is The Right Thing[tm] because the kernel does write-back
caching of data that is written out to disk files in any case, which
means that without fsync(2), the data may later be lost, no matter
what close(2) had returned.



More information about the busybox mailing list