disabling warn_unused_result attribute with FORTIFY_SOURCE?

Alan Cox alan at redhat.com
Thu Mar 15 10:38:34 UTC 2007


On Thu, Mar 15, 2007 at 08:24:33AM +0100, Ralf Ertzinger wrote:
> All the write functions return the amount of bytes actually written,
> which may be different from the amount of data you gave it to write.

They return the amount of data queued to be written.

> Many programmers ignore this (and in 99.9% of all cases get away with it
> because write actually writes the whole data), but it only _has_ to write
> a single byte before returning without error (given blocking IO).

close can itself report a write error if the write back to disk on NFS fails,
and for disk media you might want to fflush() then fsync() if you are dealing
with very precious data. That is normally overkill

Alan




More information about the fedora-devel-list mailing list