Skip to content
Snippets Groups Projects
Commit af01c0e7 authored by Tommi Rantala's avatar Tommi Rantala Committed by Kamil Dudka
Browse files

writeState(): call fflush() before fsync()

Flush the libc buffers before calling fsync().

Otherwise the file content may not yet have been written to the kernel,
and fsync() will not help in ensuring that the file data is written to
disk.

Closes #148
parent 0ac1423b
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -2313,6 +2313,9 @@ static int writeState(const char *stateFilename)
}
}
 
if (error == 0)
error = fflush(f);
if (error == 0)
error = fsync(fdsave);
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment