- 论坛徽章:
- 0
|
看close()的说明
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.
A successful close does not guarantee that the data has been successfully saved to disk, as the kernel defers
writes. It is not common for a filesystem to flush the buffers when the stream is closed. If you need to be
sure that the data is physically stored use fsync(2). |
|