diff --git a/lib/mfile.cpp b/lib/mfile.cpp index 40d3400c39..31a40cb7ef 100644 --- a/lib/mfile.cpp +++ b/lib/mfile.cpp @@ -148,10 +148,13 @@ int MFILE::puts(const char* p) { return n; } +// This is closing the file even if it couldn't flush it. +// The caller needs to check the return value and open the file again before the next retry. +// int MFILE::close() { int retval = 0; if (f) { - flush(); + retval = flush(); fclose(f); f = NULL; }