Gave problem handling finer granularity within loops

This commit is contained in:
2007-11-11 11:21:46 +00:00
parent 6cc5a50ba4
commit 40b5f82b95
4 changed files with 218 additions and 126 deletions

View File

@ -494,6 +494,7 @@ int Xorriso_normalize_img_path(struct XorrisO *xorriso, char *img_path,
return(ret);
}
apt= npt= path;
if(img_path[0]!='/') {
if(flag&4)
strcpy(path, xorriso->wdx);
@ -505,7 +506,6 @@ int Xorriso_normalize_img_path(struct XorrisO *xorriso, char *img_path,
} else
if(Sfile_str(path, img_path, 0)<=0)
return(-1);
apt= npt= path;
if(path[0]!='/') {
sprintf(xorriso->info_text,
@ -613,7 +613,7 @@ int Xorriso_add_tree(struct XorrisO *xorriso, struct iso_tree_node_dir *dir,
{
struct iso_volume *volume;
struct iso_tree_node *node;
int ret, target_is_dir, source_is_dir;
int ret, target_is_dir, source_is_dir, fret, was_failure= 0;
struct DirseQ *dirseq= NULL;
char sfe[5*SfileadrL], sfe2[5*SfileadrL];
char disk_path[2*SfileadrL], img_path[2*SfileadrL];
@ -660,15 +660,15 @@ int Xorriso_add_tree(struct XorrisO *xorriso, struct iso_tree_node_dir *dir,
}
strcpy(img_name, name);
if(Xorriso_much_too_long(xorriso, strlen(img_path), 0)<=0)
goto was_problem;
{ret= 0; goto was_problem;}
if(Xorriso_much_too_long(xorriso, strlen(disk_path), 0)<=0)
goto was_problem;
{ret= 0; goto was_problem;}
if(lstat(disk_path, &stbuf)==-1) {
sprintf(xorriso->info_text,
"Cannot determine attributes of source file %s",
Text_shellsafe(disk_path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "SORRY", 0);
goto was_problem;
ret= 0; goto was_problem;
}
source_is_dir= 0;
if(S_ISDIR(stbuf.st_mode)) {
@ -677,7 +677,7 @@ int Xorriso_add_tree(struct XorrisO *xorriso, struct iso_tree_node_dir *dir,
sprintf(xorriso->info_text,"Source file %s is of non-supported file type",
Text_shellsafe(disk_path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
goto was_problem;
ret= 0; goto was_problem;
}
/* does a node exist with this name ? */
@ -697,7 +697,7 @@ int Xorriso_add_tree(struct XorrisO *xorriso, struct iso_tree_node_dir *dir,
sprintf(xorriso->info_text, "User revoked adding of: %s",
Text_shellsafe(disk_path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
goto was_problem;
ret= 0; goto was_problem;
}
node= NULL;
} else {
@ -705,7 +705,7 @@ int Xorriso_add_tree(struct XorrisO *xorriso, struct iso_tree_node_dir *dir,
"While grafting %s : file object exists and may not be overwritten",
Text_shellsafe(img_path,sfe,0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
goto was_problem;
ret= 0; goto was_problem;
}
}
}
@ -719,30 +719,31 @@ int Xorriso_add_tree(struct XorrisO *xorriso, struct iso_tree_node_dir *dir,
Text_shellsafe(img_path,sfe,0), Text_shellsafe(disk_path,sfe2,0),
libisofs_errno);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
goto was_problem;
ret=0; goto was_problem;
}
/* name always equal to disk. Obsolete: iso_tree_node_set_name(node,name);*/
if(source_is_dir) {
ret= Xorriso_add_tree(xorriso, (struct iso_tree_node_dir *) node,
img_path, disk_path, 1);
if(ret<0)
{ret= -1; goto ex;}
if(ret==0)
if(ret<=0)
goto was_problem;
}
continue;
continue; /* regular bottom of loop */
was_problem:;
ret= Xorriso_eval_problem_status(xorriso, 0, 1);
if(ret<0)
{ret= 0; goto ex;}
was_failure= 1;
fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
if(fret<0)
goto ex;
}
ret= 1;
ex:
Xorriso_process_msg_queues(xorriso,0);
Dirseq_destroy(&dirseq, 0);
return(ret);
if(ret<=0)
return(ret);
return(!was_failure);
}
@ -976,7 +977,7 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
{
int num_sessions= 0, num_tracks= 0, lba= 0, nwa= -1, pmin, psec, pframe, ret;
int track_count= 0, session_no, track_no, profile_no= -1;
int last_track_start= 0, last_track_size= -1, num_data= 0, is_data;
int last_track_start= 0, last_track_size= -1, num_data= 0, is_data= 0;
char profile_name[80],*respt;
struct burn_disc *disc= NULL;
struct burn_session **sessions;
@ -1425,7 +1426,7 @@ int Xorriso_node_from_path(struct XorrisO *xorriso, struct iso_volume *volume,
int Xorriso_rmi(struct XorrisO *xorriso, void *boss_iter,
char *path, int flag)
{
int ret, is_dir= 0, pl, not_removed= 0;
int ret, is_dir= 0, pl, not_removed= 0, fret;
struct iso_tree_node *victim_node, *node;
struct iso_tree_node_dir *boss_node, *root_dir;
struct iso_tree_iter *iter= NULL;
@ -1476,21 +1477,25 @@ int Xorriso_rmi(struct XorrisO *xorriso, void *boss_iter,
&& !xorriso->request_to_abort) {
name= (char *) iso_tree_node_get_name(node);
if(Xorriso_much_too_long(xorriso, pl+1+strlen(name), 0)<=0)
{ret= 0; goto ex;}
{ret= 0; goto rm_r_problem_handler;}
strcpy(sub_name, name);
ret= Xorriso_rmi(xorriso, iter, sub_path, (flag&(1|2|8))|4);
if(ret<=0)
goto ex;
if(ret==3)
if(ret==3 || ret<=0 || xorriso->request_to_abort) {
rm_r_problem_handler:;
not_removed= 1;
fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
if(fret<0)
goto dir_not_removed;
}
}
if(not_removed) {
if(!(flag&4)) {
sprintf(xorriso->info_text, "Directory not removed: %s",
Text_shellsafe(path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
}
ret= 3; goto ex;
dir_not_removed:;
sprintf(xorriso->info_text, "Directory not removed: %s",
Text_shellsafe(path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
if(ret>0)
ret= 3;
goto ex;
}
}
} else {
@ -1538,16 +1543,14 @@ int Xorriso_rmi(struct XorrisO *xorriso, void *boss_iter,
sprintf(xorriso->info_text,
"Remove above file ? n= keep it, y= remove it, x= abort, @= stop asking\n");
Xorriso_info(xorriso, 4);
ret= Xorriso_request_confirmation(xorriso, 1|2|4);
ret= Xorriso_request_confirmation(xorriso, 1|2|4|16);
if(ret<=0)
goto ex;
if(xorriso->request_to_abort) {
if(!(flag&4)) {
sprintf(xorriso->info_text,
"Removal operation aborted by user before file: %s",
Text_shellsafe(path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
}
sprintf(xorriso->info_text,
"Removal operation aborted by user before file: %s",
Text_shellsafe(path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
ret= 3; goto ex;
}
if(ret==3)
@ -1694,7 +1697,8 @@ much_too_long:;
{ret= -1; goto ex;}
}
filec++;
mem+= strlen(rel_path)+1;
l= strlen(rel_path)+1;
mem+= l;
if(l % sizeof(char *))
mem+= sizeof(char *)-(l % sizeof(char *));
ret= Xorriso_show_du_subs(xorriso, (struct iso_tree_node_dir *) node,
@ -1857,7 +1861,7 @@ much_too_long:;
if(!(flag&(2|4))) {
sprintf(xorriso->info_text, "Valid ISO nodes found: %d\n", filec-was_error);
Xorriso_info(xorriso,0);
Xorriso_info(xorriso,1);
if(filec-was_error<=0)
return(!was_error);
}
@ -1990,7 +1994,7 @@ wdi_is_not_a_dir:;
Xorriso_process_msg_queues(xorriso,0);
sprintf(xorriso->info_text, "Valid ISO nodes found: %d\n", filec);
Xorriso_info(xorriso,0);
Xorriso_info(xorriso,1);
ret= Xorriso_sorted_node_array(xorriso, dir_node, &filec, &node_array, 0,
flag&4);
@ -2113,8 +2117,8 @@ int Xorriso_rename(struct XorrisO *xorriso, char *origin, char *dest, int flag)
}
/* Check whether destination exists and may be not overwriteable */
if(dest_ret==2) {
sprintf(xorriso->info_text, "Renaming refuses to unlink directory: %s",
if(dest_ret==2 && xorriso->do_overwrite!=1) {
sprintf(xorriso->info_text, "Renaming may not overwrite directory: %s",
Text_shellsafe(eff_dest, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
return(0);
@ -2124,7 +2128,7 @@ int Xorriso_rename(struct XorrisO *xorriso, char *origin, char *dest, int flag)
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
return(0);
} else if(dest_ret>0) {
ret= Xorriso_rmi(xorriso, NULL, eff_dest, 8);
ret= Xorriso_rmi(xorriso, NULL, eff_dest, 1|8);
if(ret<=0)
return(0);
if(ret==3) {
@ -2332,7 +2336,7 @@ int Xorriso_expand_pattern(struct XorrisO *xorriso,
int nonconst_mismatches= 0;
char mem_text[80], limit_text[80], sfe[5*SfileadrL];
struct iso_volume *volume;
struct iso_tree_node_dir *dir, *root_dir;
struct iso_tree_node_dir *dir= NULL, *root_dir;
*filec= 0;
*filev= NULL;