change permissions before fsync()
[libi2ncommon] / src / oftmpstream.cpp
index bf4dda9..71fadd4 100644 (file)
@@ -121,8 +121,8 @@ void oftmpstream::close()
     if (!is_open)
         return;
 
-    fsync(fd);
     fchmod (fd, file_mode);    // fix/change mkstemp permissions
+    fsync(fd);
     ::close (fd);
 
     if (rename (tmpname.c_str(), realname.c_str()) != 0)