소스 검색

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.
Vincent Penquerc'h 10 년 전
부모
커밋
81e9f967be
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      qubes-rpc/vm-file-editor.c

+ 1 - 1
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);