summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/macdeployqt/shared/shared.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/macdeployqt/shared/shared.cpp b/src/macdeployqt/shared/shared.cpp
index 3ebd04335..210366be8 100644
--- a/src/macdeployqt/shared/shared.cpp
+++ b/src/macdeployqt/shared/shared.cpp
@@ -103,6 +103,19 @@ bool copyFilePrintStatus(const QString &from, const QString &to)
dest.setPermissions(dest.permissions() | QFile::WriteOwner | QFile::WriteUser);
LogNormal() << " copied:" << from;
LogNormal() << " to" << to;
+
+ // The source file might not have write permissions set. Set the
+ // write permission on the target file to make sure we can use
+ // install_name_tool on it later.
+ QFile toFile(to);
+ if (toFile.permissions() & QFile::WriteOwner)
+ return true;
+
+ if (!toFile.setPermissions(toFile.permissions() | QFile::WriteOwner)) {
+ LogError() << "Failed to set u+w permissions on target file: " << to;
+ return false;
+ }
+
return true;
} else {
LogError() << "file copy failed from" << from;