summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2014-04-07 10:32:17 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2014-04-07 10:32:17 +0000
commit6248a3a482e57395d11737d061d7c693b6732c3d (patch)
treec2d48436030993d45935c46eba4f39760ee6449c
parent4a9f894d979064160d56d8a9e8435ecf67bb1cd5 (diff)
save-buffer needs to use O_TRUNC.
-rw-r--r--usr.bin/tmux/cmd-save-buffer.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/tmux/cmd-save-buffer.c b/usr.bin/tmux/cmd-save-buffer.c
index 6e45c7e25b7..20755780b34 100644
--- a/usr.bin/tmux/cmd-save-buffer.c
+++ b/usr.bin/tmux/cmd-save-buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-save-buffer.c,v 1.21 2013/10/10 12:26:35 nicm Exp $ */
+/* $OpenBSD: cmd-save-buffer.c,v 1.22 2014/04/07 10:32:16 nicm Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -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");
}