change permissions before fsync()
authorPhilipp Gesang <philipp.gesang@intra2net.com>
Tue, 24 Apr 2018 11:23:12 +0000 (13:23 +0200)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Tue, 24 Apr 2018 11:34:22 +0000 (13:34 +0200)
Reorder the calls so that the metadata changes performed by
fchmod() are committed to disk (journal) the same way as the
data.

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)