mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-07 14:33:15 +00:00
"Help keep our secrets secret."
Added code to respect the umask value. Before, files were generated world readable, which may not be desirable for all installations. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8215 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6666a04c6c
commit
3a9ce67289
@ -433,6 +433,9 @@ int main(int argc, char **argv) {
|
|||||||
Out.close();
|
Out.close();
|
||||||
|
|
||||||
if (!LinkAsLibrary) {
|
if (!LinkAsLibrary) {
|
||||||
|
// Permissions masking value of the user
|
||||||
|
mode_t mask;
|
||||||
|
|
||||||
// Output the script to start the program...
|
// Output the script to start the program...
|
||||||
std::ofstream Out2(OutputFilename.c_str());
|
std::ofstream Out2(OutputFilename.c_str());
|
||||||
if (!Out2.good())
|
if (!Out2.good())
|
||||||
@ -441,11 +444,22 @@ int main(int argc, char **argv) {
|
|||||||
Out2 << "#!/bin/sh\nlli -q -abort-on-exception $0.bc $*\n";
|
Out2 << "#!/bin/sh\nlli -q -abort-on-exception $0.bc $*\n";
|
||||||
Out2.close();
|
Out2.close();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Grab the umask value from the operating system. We want to use it when
|
||||||
|
// changing the file's permissions.
|
||||||
|
//
|
||||||
|
// Note:
|
||||||
|
// Umask() is one of those annoying system calls. You have to call it
|
||||||
|
// to get the current value and then set it back.
|
||||||
|
//
|
||||||
|
mask = umask (0);
|
||||||
|
umask (mask);
|
||||||
|
|
||||||
// Make the script executable...
|
// Make the script executable...
|
||||||
chmod(OutputFilename.c_str(), 0755);
|
chmod(OutputFilename.c_str(), (0755 & ~mask));
|
||||||
|
|
||||||
// Make the bytecode file directly executable in LLEE as well
|
// Make the bytecode file directly executable in LLEE as well
|
||||||
chmod(RealBytecodeOutput.c_str(), 0755);
|
chmod(RealBytecodeOutput.c_str(), (0755 & ~mask));
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user