Disallowed -clone to overwrite existing nodes

This commit is contained in:
2011-02-02 17:41:52 +00:00
parent aae50b2d16
commit 435cd88e83
6 changed files with 69 additions and 65 deletions

View File

@ -1385,7 +1385,7 @@ int Xorriso_clone_tree(struct XorrisO *xorriso, void *boss_iter,
char *leafname;
IsoImage *volume;
IsoDir *new_parent;
IsoNode *origin_node, *dir_node, *new_node, *dest_node= NULL;
IsoNode *origin_node, *dir_node, *new_node;
ret= Xorriso_get_volume(xorriso, &volume, 0);
if(ret <= 0)
@ -1402,16 +1402,13 @@ int Xorriso_clone_tree(struct XorrisO *xorriso, void *boss_iter,
if(dest_ret<0)
return(dest_ret);
if(dest_ret > 0) {
ret= Xorriso_node_from_path(xorriso, volume, eff_dest, &dest_node, 0);
if(ret <= 0)
return(ret);
if(dest_node == origin_node) {
sprintf(xorriso->info_text,
"Cloning: Original and copy have the same iso_rr_path: ");
Text_shellsafe(eff_dest, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
}
if(eff_dest[0] == 0)
strcpy(eff_dest, "/");
sprintf(xorriso->info_text,
"Cloning: Copy address already exists : ");
Text_shellsafe(eff_dest, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
} else {
/* obtain eff_dest address despite it does not exist */
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, dest, eff_dest, 2);
@ -1419,11 +1416,6 @@ int Xorriso_clone_tree(struct XorrisO *xorriso, void *boss_iter,
return(ret);
}
ret= Xorriso_overwrite_dest(xorriso, boss_iter,
eff_dest, dest_ret, "Cloning", 0);
if(ret <= 0)
return(ret);
/* Obtain parent path and leaf name */
strcpy(dir_adr, eff_dest);
for(l= strlen(dir_adr); l > 0; ) {