From 73c5a487c1b0f10bbc36479f425fb9cea512be7b Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 7 Apr 2014 10:32:16 +0000 Subject: [PATCH] save-buffer needs to use O_TRUNC. --- cmd-save-buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"); }