Re: [Mutt] #2962: fsync() is not called for messages written to
#2962: fsync() is not called for messages written to maildir
Changes (by Safari):
* status: closed => reopened
* resolution: fixed =>
Comment:
You should call fflush before fsync.
May I suggest something: add function safe_fclose_fsync into lib.c
and call safe_fclose_fsync instead of safe_fclose in mh.c.
Then it's also easy to call safe_fclose_fsync when for example saving
attachments...
{{{
int safe_fclose_fsync (FILE **f)
{
int r = 0;
if (*f) {
if (fflush(*f) == EOF || ((fsync(fileno(*f)) == -1) && errno !=
EINVAL)) {
r = -1;
fclose (*f);
} else {
r = fclose (*f);
}
}
*f = NULL;
return r;
}
}}}
--
Ticket URL: <http://dev.mutt.org/trac/ticket/2962#comment:3>