Stephen Smoogen <ssmoo...@redhat.com> writes:

> I have seen this listed as NOT A BUG even with realtime programmers because
> the application can be run in all kinds of ways which could induce failures
> that are 'environment' versus 'application'. I expect it depends on the
> exact environment but what is the correct code?

AFAIU, it's best to call fsync() before calling close().
The manpage for close() suggests the following [1]:

    A careful programmer who wants to know about I/O errors may precede
    close() with a call to fsync(2).

It's also worth mentioning that printf() may not be able to catch this
kind of error [2].

[1] 
https://www.mankier.com/2/close#Notes-Dealing_with_error_returns_from_close()
[2] https://www.mankier.com/2/close#Errors-ENOSPC

-- 
Tulio Magno
-- 
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to