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.
This commit is contained in:
Vincent Penquerc'h 2013-12-29 07:08:50 -05:00 committed by Marek Marczykowski-Górecki
parent 11b8f9be20
commit 81e9f967be

View File

@ -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);