From 81e9f967be0495161975dd7cdf5018646b070520 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Sun, 29 Dec 2013 07:08:50 -0500 Subject: [PATCH] vm-file-editor: do not overwite an existing file Either a housekeeping file from that VM, or a similarly named one being edited from a third VM. --- qubes-rpc/vm-file-editor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qubes-rpc/vm-file-editor.c b/qubes-rpc/vm-file-editor.c index 83fa972..f37b04a 100644 --- a/qubes-rpc/vm-file-editor.c +++ b/qubes-rpc/vm-file-editor.c @@ -44,7 +44,7 @@ char *get_filename() void copy_file(char *filename) { - int fd = open(filename, O_WRONLY | O_CREAT, 0600); + int fd = open(filename, O_WRONLY | O_CREAT | O_EXCL, 0600); if (fd < 0) { perror("open file"); exit(1);