summaryrefslogtreecommitdiffstats
path: root/cmd-save-buffer.c
diff options
context:
space:
mode:
authornicm <nicm>2014-04-07 10:32:16 +0000
committernicm <nicm>2014-04-07 10:32:16 +0000
commit73c5a487c1b0f10bbc36479f425fb9cea512be7b (patch)
treea77fb424e905108fca0f614ac4791f8916884eda /cmd-save-buffer.c
parentacef311fe356f408690e9f94727ed63a934b742f (diff)
save-buffer needs to use O_TRUNC.
Diffstat (limited to 'cmd-save-buffer.c')
-rw-r--r--cmd-save-buffer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/cmd-save-buffer.c b/cmd-save-buffer.c
index 1b0a4e7b..6c15fb42 100644
--- a/cmd-save-buffer.c
+++ b/cmd-save-buffer.c
@@ -112,7 +112,7 @@ cmd_save_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
if (fd != -1)
f = fdopen(fd, "ab");
} else {
- fd = openat(cwd, path, O_CREAT|O_RDWR, 0600);
+ fd = openat(cwd, path, O_CREAT|O_RDWR|O_TRUNC, 0600);
if (fd != -1)
f = fdopen(fd, "wb");
}