[PATCH] D159407: [BOLT] Incorporate umask into the output file permission
Jiapeng Zhou via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 2 21:13:23 PDT 2023
Kepontry created this revision.
Kepontry added reviewers: maksfb, rafauler, hzq, Amir, yota9.
Kepontry added a project: bolt.
Herald added subscribers: treapster, ayermolo.
Herald added a project: All.
Kepontry requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Fix https://github.com/llvm/llvm-project/issues/65061
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D159407
Files:
bolt/lib/Rewrite/MachORewriteInstance.cpp
bolt/lib/Rewrite/RewriteInstance.cpp
Index: bolt/lib/Rewrite/RewriteInstance.cpp
===================================================================
--- bolt/lib/Rewrite/RewriteInstance.cpp
+++ bolt/lib/Rewrite/RewriteInstance.cpp
@@ -5359,7 +5359,10 @@
}
Out->keep();
- EC = sys::fs::setPermissions(opts::OutputFilename, sys::fs::perms::all_all);
+ EC = sys::fs::setPermissions(
+ opts::OutputFilename,
+ static_cast<sys::fs::perms>(sys::fs::perms::all_all &
+ ~sys::fs::getUmask()));
check_error(EC, "cannot set permissions of output file");
}
Index: bolt/lib/Rewrite/MachORewriteInstance.cpp
===================================================================
--- bolt/lib/Rewrite/MachORewriteInstance.cpp
+++ bolt/lib/Rewrite/MachORewriteInstance.cpp
@@ -564,8 +564,10 @@
writeInstrumentationSection("I__literal16", OS);
Out->keep();
- EC = sys::fs::setPermissions(opts::OutputFilename,
- sys::fs::perms::all_all);
+ EC = sys::fs::setPermissions(
+ opts::OutputFilename,
+ static_cast<sys::fs::perms>(sys::fs::perms::all_all &
+ ~sys::fs::getUmask()));
check_error(EC, "cannot set permissions of output file");
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159407.555611.patch
Type: text/x-patch
Size: 1228 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230903/1f1e8600/attachment.bin>
More information about the llvm-commits
mailing list