diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2021-11-19 20:06:13 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2021-11-19 20:06:13 +0000 |
| commit | c0981da47d5696fe36474fcf86b4ce03ae3ff818 (patch) | |
| tree | f42add1021b9f2ac6a69ac7cf6c4499962739a45 /lldb/source/Host/common/FileSystem.cpp | |
| parent | 344a3780b2e33f6ca763666c380202b18aab72a3 (diff) | |
Diffstat (limited to 'lldb/source/Host/common/FileSystem.cpp')
| -rw-r--r-- | lldb/source/Host/common/FileSystem.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lldb/source/Host/common/FileSystem.cpp b/lldb/source/Host/common/FileSystem.cpp index a2c3b3556a6c..7687ad6c20a6 100644 --- a/lldb/source/Host/common/FileSystem.cpp +++ b/lldb/source/Host/common/FileSystem.cpp @@ -381,13 +381,13 @@ static int OpenWithFS(const FileSystem &fs, const char *path, int flags, return const_cast<FileSystem &>(fs).Open(path, flags, mode); } -static int GetOpenFlags(uint32_t options) { - const bool read = options & File::eOpenOptionRead; - const bool write = options & File::eOpenOptionWrite; - +static int GetOpenFlags(File::OpenOptions options) { int open_flags = 0; - if (write) { - if (read) + File::OpenOptions rw = + options & (File::eOpenOptionReadOnly | File::eOpenOptionWriteOnly | + File::eOpenOptionReadWrite); + if (rw == File::eOpenOptionWriteOnly || rw == File::eOpenOptionReadWrite) { + if (rw == File::eOpenOptionReadWrite) open_flags |= O_RDWR; else open_flags |= O_WRONLY; @@ -403,7 +403,7 @@ static int GetOpenFlags(uint32_t options) { if (options & File::eOpenOptionCanCreateNewOnly) open_flags |= O_CREAT | O_EXCL; - } else if (read) { + } else if (rw == File::eOpenOptionReadOnly) { open_flags |= O_RDONLY; #ifndef _WIN32 |
