Skip to content

Commit

Permalink
Pass compulsory mode argument to open when O_CREAT is used
Browse files Browse the repository at this point in the history
From `man 2 open`:

> The mode argument must be supplied if O_CREAT or O_TMPFILE is
> specified in flags; if it is not supplied, some arbitrary bytes
> from the stack will be applied as the file mode.
  • Loading branch information
teohhanhui committed May 2, 2024
1 parent 7c79e5d commit 7519af2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Source/Tools/FEXLoader/FEXLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,8 @@ int main(int argc, char** argv, char** const envp) {
LogMan::Msg::InstallHandler(FEXServerLogging::MsgHandler);
}
} else if (!LogFile.empty()) {
OutputFD = open(LogFile.c_str(), O_CREAT | O_CLOEXEC | O_WRONLY);
constexpr int USER_PERMS = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
OutputFD = open(LogFile.c_str(), O_CREAT | O_CLOEXEC | O_WRONLY, USER_PERMS);
}
}

Expand Down

0 comments on commit 7519af2

Please sign in to comment.