1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

pvck: improve error for write to existing file

This commit is contained in:
David Teigland 2023-04-28 13:31:39 -05:00
parent 6d262eaf64
commit c4440b5b49

View File

@ -1444,8 +1444,13 @@ static int _dump_metadata(struct cmd_context *cmd, const char *dump, struct sett
int bad = 0; int bad = 0;
if (arg_is_set(cmd, file_ARG)) { if (arg_is_set(cmd, file_ARG)) {
struct stat sb;
if (!(tofile = arg_str_value(cmd, file_ARG, NULL))) if (!(tofile = arg_str_value(cmd, file_ARG, NULL)))
return 0; return 0;
if (!stat(tofile, &sb)) {
log_error("File already exists.");
return 0;
}
} }
if (set->mda_num) if (set->mda_num)