From: Philipp Gesang Date: Tue, 24 Apr 2018 11:23:12 +0000 (+0200) Subject: change permissions before fsync() X-Git-Tag: v2.10~7 X-Git-Url: http://developer.intra2net.com/git/?p=libi2ncommon;a=commitdiff_plain;h=16d42e06a948baedc7b64502a7b2e05fd1f918c0 change permissions before fsync() Reorder the calls so that the metadata changes performed by fchmod() are committed to disk (journal) the same way as the data. --- diff --git a/src/oftmpstream.cpp b/src/oftmpstream.cpp index bf4dda9..71fadd4 100644 --- a/src/oftmpstream.cpp +++ b/src/oftmpstream.cpp @@ -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)