summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--util/env_posix.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/util/env_posix.cc b/util/env_posix.cc
index 1a88802..8d84ac7 100644
--- a/util/env_posix.cc
+++ b/util/env_posix.cc
@@ -429,7 +429,7 @@ class PosixEnv : public Env {
virtual Status NewWritableFile(const std::string& fname,
WritableFile** result) {
Status s;
- int fd = open(fname.c_str(), O_RDWR | O_CREAT, 0644);
+ int fd = open(fname.c_str(), O_TRUNC | O_WRONLY | O_CREAT, 0644);
if (fd < 0) {
*result = NULL;
s = PosixError(fname, errno);
@@ -442,7 +442,7 @@ class PosixEnv : public Env {
virtual Status NewAppendableFile(const std::string& fname,
WritableFile** result) {
Status s;
- int fd = open(fname.c_str(), O_APPEND | O_RDWR | O_CREAT, 0644);
+ int fd = open(fname.c_str(), O_APPEND | O_WRONLY | O_CREAT, 0644);
if (fd < 0) {
*result = NULL;
s = PosixError(fname, errno);