Hi!

I just lost the contents of licq.conf on a machine where I was over disk
quota (on NFS). This seems to have happened because CIniFile::FlushFile
does not check the return value of close. From the close(2) man page:
"Not checking the return value when closing the file may lead to silent
loss of data. This can especially be observed with NFS and disk quotas."

The attached patch should fix this.
? autom4te.cache
? plugins/qt-gui/autom4te.cache
Index: src/file.cpp
===================================================================
RCS file: /cvsroot/licq/licq/src/file.cpp,v
retrieving revision 1.16
diff -u -3 -p -r1.16 file.cpp
--- src/file.cpp	29 Jan 2004 14:34:10 -0000	1.16
+++ src/file.cpp	9 Jun 2004 10:02:28 -0000
@@ -312,7 +312,13 @@ bool CIniFile::FlushFile()
   }
   else
   {
-    close (nFD);
+    if (close(nFD))
+    {
+        // close failed, data may have not been written
+        unlink(tempname);
+        return false;
+    }
+
     if(rename(tempname, m_szFilename))
     {
         // rename failed..
ciao
  Jörg

Reply via email to