From f4a0cd267d035d17a4b118578e8a086af6b42ba0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=CC=81clav=20Slavi=CC=81k?= Date: Tue, 23 Feb 2016 12:45:23 +0100 Subject: [PATCH] Fix setting of new files' permissions on Unix The changes in 0c39a4ab21c75568c0fb65fef1f13b7327d732ac accidentally tried to preserve permissions of existing file even if one didn't exist, leading to setting essentially random permissions. --- src/utility.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/utility.cpp b/src/utility.cpp index 8f83c5c778..1bbed25013 100644 --- a/src/utility.cpp +++ b/src/utility.cpp @@ -263,8 +263,11 @@ bool TempOutputFileFor::ReplaceFile(const wxString& temp, const wxString& dest) return false; #ifdef __UNIX__ - chown(destPath, st.st_uid, st.st_gid); - chmod(destPath, st.st_mode); + if (overwrite) + { + chown(destPath, st.st_uid, st.st_gid); + chmod(destPath, st.st_mode); + } #endif return true;