Commit 435cd88e authored by Thomas Schmitt's avatar Thomas Schmitt

Disallowed -clone to overwrite existing nodes

parent aae50b2d
......@@ -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; ) {
......
......@@ -9,7 +9,7 @@
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH XORRISO 1 "Jan 29, 2011"
.TH XORRISO 1 "Feb 02, 2011"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
......@@ -1053,12 +1053,15 @@ other file causes a FAILURE event.
\fB\-clone\fR iso_rr_path_original iso_rr_path_copy
Create a copy of the ISO file object iso_rr_path_original with the new
address iso_rr_path_copy. If the original is a directory then copy all
files and directories underneath. Boot catalog are not copied but
silently ignored.
files and directories underneath. An eventual boot catalog file gets
not copied but is silently ignored.
.br
The copied ISO file objects have the same attributes. Copied data files
refer to the same content source as their originals.
The copies may then be manipulated independendly of their originals.
.br
This command will refuse execution if the address iso_rr_path_copy
already exists in the ISO tree.
.TP
.B Settings for file insertion:
.TP
......
No preview for this file type
......@@ -44,7 +44,7 @@
@c man .\" First parameter, NAME, should be all caps
@c man .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
@c man .\" other parameters are allowed: see man(7), man(1)
@c man .TH XORRISO 1 "Jan 29, 2011"
@c man .TH XORRISO 1 "Feb 02, 2011"
@c man .\" Please adjust this date whenever revising the manpage.
@c man .\"
@c man .\" Some roff macros, for reference:
......@@ -1317,12 +1317,15 @@ other file causes a FAILURE event.
@cindex Directory, copy, -clone
Create a copy of the ISO file object iso_rr_path_original with the new
address iso_rr_path_copy. If the original is a directory then copy all
files and directories underneath. Boot catalog are not copied but
silently ignored.
files and directories underneath. An eventual boot catalog file gets
not copied but is silently ignored.
@*
The copied ISO file objects have the same attributes. Copied data files
refer to the same content source as their originals.
The copies may then be manipulated independendly of their originals.
@*
This command will refuse execution if the address iso_rr_path_copy
already exists in the ISO tree.
@end table
@c man .TP
@c man .B Settings for file insertion:
......
#define Xorriso_timestamP "2011.02.01.185830"
#define Xorriso_timestamP "2011.02.02.174154"
......@@ -112,6 +112,9 @@ int Xorriso_blank_as_needed(struct XorrisO *xorriso, int flag);
bit1= remove empty directory: rmdir
bit2= recursion: do not reassure in mode 2 "tree"
bit3= this is for overwriting and not for plain removal
bit4= count deleted files in xorriso->pacifier_count
bit5= with bit0 only remove directory content, not the directory
bit6= do not delete eventually existing node from di_array
@return <=0 = error
1 = removed simple node
2 = removed directory or tree
......@@ -120,6 +123,7 @@ int Xorriso_blank_as_needed(struct XorrisO *xorriso, int flag);
int Xorriso_rmi(struct XorrisO *xorriso, void *boss_iter, off_t boss_mem,
char *path, int flag);
/* @param flag bit0= long format
bit1= do not print count of nodes
bit2= du format
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment