[flang-commits] [PATCH] D127015: [flang][runtime] OPEN write-only files
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Fri Jun 3 18:10:02 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe5a4f730dafd: [flang][runtime] OPEN write-only files (authored by klausler).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127015/new/
https://reviews.llvm.org/D127015
Files:
flang/runtime/file.cpp
Index: flang/runtime/file.cpp
===================================================================
--- flang/runtime/file.cpp
+++ flang/runtime/file.cpp
@@ -97,12 +97,18 @@
flags |= O_TRUNC;
}
if (!action) {
- // Try to open read/write, back off to read-only on failure
+ // Try to open read/write, back off to read-only or even write-only
+ // on failure
fd_ = ::open(path_.get(), flags | O_RDWR, 0600);
if (fd_ >= 0) {
action = Action::ReadWrite;
} else {
- action = Action::Read;
+ fd_ = ::open(path_.get(), flags | O_RDONLY, 0600);
+ if (fd_ >= 0) {
+ action = Action::Read;
+ } else {
+ action = Action::Write;
+ }
}
}
if (fd_ < 0) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127015.434227.patch
Type: text/x-patch
Size: 770 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220604/664af40f/attachment.bin>
More information about the flang-commits
mailing list