Skip to contentSkip to conversation

LVM2 ./WHATS_NEW tools/vgcfgbackup.c

PATCH [email protected] 1 participant 1 message Aug 13, 2008

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: mbroz at sourceware.org 2008-08-13 12:44:24

Modified files:
. : WHATS_NEW
tools : vgcfgbackup.c

Log message:
Fix vgcfgbackup to properly check filename if template is used.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.945&r2=1.946
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgcfgbackup.c.diff?cvsroot=lvm2&r1=1.24&r2=1.25

WHATS_NEW +1 -0
@@ -1,5 +1,6 @@
 Version 2.02.40 - 
 ================================
+  Fix vgcfgbackup to properly check filename if template is used.
   configure aborts if lcov or genhtml are missing with --enable-profiling
   vgremove tries to remove lv snapshot first.
   Added function lv_remove_with_dependencies().
tools/vgcfgbackup.c +3 -3
@@ -34,8 +34,7 @@
 		dm_free(filename);	
 		return NULL;
 	}
-	if (*last_filename && !strncmp(*last_filename, filename,
-				      strlen(template))) {
+	if (*last_filename && !strncmp(*last_filename, filename, PATH_MAX)) {
 		log_error("VGs must be backed up into different files. "
 			  "Use %%s in filename for VG name.");
 		dm_free(filename);
@@ -70,7 +69,8 @@
 			return ECMD_FAILED;
 		}
 
-		backup_to_file(filename, vg->cmd->cmd_line, vg);
+		if (!backup_to_file(filename, vg->cmd->cmd_line, vg))
+			return ECMD_FAILED;
 	} else {
 		if (!consistent) {
 			log_error("No backup taken: specify filename with -f "