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

Explicitly close (=>flush) files.

This commit is contained in:
Alasdair Kergon 2002-01-09 13:07:03 +00:00
parent 67fb2a39a7
commit d413c0ce38

View File

@ -73,12 +73,18 @@ static int _vg_write(struct format_instance *fi, struct volume_group *vg)
/* FIXME: should be opened exclusively */
if (!(fp = fopen(file, "w"))) {
log_err("Couldn't open text file '%s'.", file);
log_sys_error("fopen", file);
return 0;
}
if (!text_vg_export(fp, vg)) {
log_err("Couldn't write text format file.");
log_error("Failed to write metadata to %s.", file);
fclose(fp);
return 0;
}
if (!fclose(fp)) {
log_sys_error("fclose", file);
return 0;
}