summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornoshbar <noshbar@gmail.com>2019-10-09 15:01:11 +0200
committerJustin Moore <arkolbed@gmail.com>2020-02-08 14:43:46 -0600
commit2ce455fc73c229b9a551e44648d028c65fc464ef (patch)
tree0a0031d423aa8fe88a03df704bc5962f5dd0c6f3
parent85fb028faae183e8dd2630b84d07633abd2edb7f (diff)
[Base] Initialize file 'open_access' flag before using it.
In the 'OpenExisting' function, 'open_access' is used to create the flags for opening the file. However, it is not set to zero, so could end up being incorrect file modes, potentially even emptying the file for appending, which would be bad. This simply initialises it to zero first.
-rw-r--r--src/xenia/base/filesystem_posix.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/xenia/base/filesystem_posix.cc b/src/xenia/base/filesystem_posix.cc
index caf8219ad..f0ca77bf4 100644
--- a/src/xenia/base/filesystem_posix.cc
+++ b/src/xenia/base/filesystem_posix.cc
@@ -155,7 +155,7 @@ class PosixFileHandle : public FileHandle {
std::unique_ptr<FileHandle> FileHandle::OpenExisting(std::wstring path,
uint32_t desired_access) {
- int open_access;
+ int open_access = 0;
if (desired_access & FileAccess::kGenericRead) {
open_access |= O_RDONLY;
}