Call the connection callback in disconnection always as the last
[silc.git] / lib / silcutil / silcfileutil.c
index 30b2a5e5ce2001df916e0a0ebb7b8f38a309af49..c57cc42beb0457ea33b07c1f317a80457e0fb010 100644 (file)
@@ -82,9 +82,9 @@ int silc_file_writefile(const char *filename, const char *buffer,
     return -1;
   }
 
-  silc_file_close(fd);
+  fsync(fd);
 
-  return 0;
+  return silc_file_close(fd);
 }
 
 /* Writes a buffer to the file.  If the file is created specific mode is
@@ -112,9 +112,9 @@ int silc_file_writefile_mode(const char *filename, const char *buffer,
     return -1;
   }
 
-  silc_file_close(fd);
+  fsync(fd);
 
-  return 0;
+  return silc_file_close(fd);
 }
 
 /* Reads a file to a buffer. The allocated buffer is returned. Length of