From 5d5a7b32141b0cbe91542829469db3568d48408a Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Tue, 30 Nov 2010 10:47:30 +0000 Subject: [PATCH] Improved messages at the end of partially failed -extract runs --- libisoburn/trunk/xorriso/disk_ops.c | 11 ++++++++--- libisoburn/trunk/xorriso/disk_ops.h | 3 ++- libisoburn/trunk/xorriso/opts_a_c.c | 7 ++++--- libisoburn/trunk/xorriso/opts_d_h.c | 9 +++++---- libisoburn/trunk/xorriso/opts_i_o.c | 7 +++++-- libisoburn/trunk/xorriso/xorriso_timestamp.h | 2 +- 6 files changed, 25 insertions(+), 14 deletions(-) diff --git a/libisoburn/trunk/xorriso/disk_ops.c b/libisoburn/trunk/xorriso/disk_ops.c index ebbc0139..fc4f1f00 100644 --- a/libisoburn/trunk/xorriso/disk_ops.c +++ b/libisoburn/trunk/xorriso/disk_ops.c @@ -1347,10 +1347,12 @@ ex:; bit5= -extract_single: eventually do not insert directory tree */ int Xorriso_restore_sorted(struct XorrisO *xorriso, int count, - char **src_array, char **tgt_array, int flag) + char **src_array, char **tgt_array, + int *problem_count, int flag) { int i, ret, with_node_array= 0, hflag= 0, hret; + *problem_count= 0; if(!(((xorriso->ino_behavior & 16) && xorriso->do_restore_sort_lba) || (xorriso->ino_behavior & 4) || (flag & 1))) { ret= Xorriso_make_hln_array(xorriso, 0); @@ -1370,8 +1372,9 @@ int Xorriso_restore_sorted(struct XorrisO *xorriso, int count, ret= Xorriso_restore(xorriso, src_array[i], tgt_array[i], (off_t) 0, (off_t) 0, hflag); if(ret <= 0) { + (*problem_count)++; hret= Xorriso_eval_problem_status(xorriso, ret, 0); - if(ret < 0) + if(hret < 0) goto ex; } with_node_array= 1; @@ -1392,8 +1395,9 @@ int Xorriso_restore_sorted(struct XorrisO *xorriso, int count, ret= Xorriso_restore(xorriso, src_array[i], tgt_array[i], (off_t) 0, (off_t) 0, 2 << 7); if(ret <= 0) { + (*problem_count)++; hret= Xorriso_eval_problem_status(xorriso, ret, 0); - if(ret < 0) + if(hret < 0) goto ex; } } @@ -1411,6 +1415,7 @@ int Xorriso_restore_sorted(struct XorrisO *xorriso, int count, ret= Xorriso_restore(xorriso, src_array[i], tgt_array[i], (off_t) 0, (off_t) 0, 0); if(ret <= 0) { + (*problem_count)++; hret= Xorriso_eval_problem_status(xorriso, ret, flag & 32); if(ret < 0) goto ex; diff --git a/libisoburn/trunk/xorriso/disk_ops.h b/libisoburn/trunk/xorriso/disk_ops.h index 265965ed..fbce0f69 100644 --- a/libisoburn/trunk/xorriso/disk_ops.h +++ b/libisoburn/trunk/xorriso/disk_ops.h @@ -69,7 +69,8 @@ int Xorriso_findx(struct XorrisO *xorriso, struct FindjoB *job, bit5= -extract_single: eventually do not insert directory tree */ int Xorriso_restore_sorted(struct XorrisO *xorriso, int count, - char **src_array, char **tgt_array, int flag); + char **src_array, char **tgt_array, + int *problem_count, int flag); /* @param flag bit0= path is a directory bit2= recursion: do not reassure in mode 2 "tree" diff --git a/libisoburn/trunk/xorriso/opts_a_c.c b/libisoburn/trunk/xorriso/opts_a_c.c index 61f1aaf9..ab1a651b 100644 --- a/libisoburn/trunk/xorriso/opts_a_c.c +++ b/libisoburn/trunk/xorriso/opts_a_c.c @@ -1945,7 +1945,7 @@ ex:; int Xorriso_option_cpx(struct XorrisO *xorriso, int argc, char **argv, int *idx, int flag) { - int i, ret, is_dir= 0, was_failure= 0, fret, end_idx_dummy; + int i, ret, is_dir= 0, was_failure= 0, fret, end_idx_dummy, problem_count; char eff_origin[SfileadrL], eff_dest[SfileadrL]; char dest_dir[SfileadrL], leafname[SfileadrL], sfe[5*SfileadrL]; char **eff_src_array= NULL, **eff_tgt_array= NULL; @@ -2048,8 +2048,9 @@ problem_handler:; } if(eff_src_array != NULL) { - ret= Xorriso_restore_sorted(xorriso, optc, eff_src_array, eff_tgt_array, 0); - if(ret <= 0) + ret= Xorriso_restore_sorted(xorriso, optc, eff_src_array, eff_tgt_array, + &problem_count, 0); + if(ret <= 0 || problem_count > 0) was_failure= 1; } if(xorriso->pacifier_count>0) diff --git a/libisoburn/trunk/xorriso/opts_d_h.c b/libisoburn/trunk/xorriso/opts_d_h.c index babb1c40..50027853 100644 --- a/libisoburn/trunk/xorriso/opts_d_h.c +++ b/libisoburn/trunk/xorriso/opts_d_h.c @@ -486,7 +486,7 @@ int Xorriso_option_external_filter(struct XorrisO *xorriso, int Xorriso_option_extract(struct XorrisO *xorriso, char *iso_path, char *disk_path, int flag) { - int ret; + int ret, problem_count; char eff_origin[SfileadrL], eff_dest[SfileadrL], *ipth, *eopt[1], *edpt[1]; if(xorriso->allow_restore <= 0) { @@ -516,12 +516,13 @@ int Xorriso_option_extract(struct XorrisO *xorriso, char *iso_path, eopt[0]= eff_origin; edpt[0]= eff_dest; - ret= Xorriso_restore_sorted(xorriso, 1, eopt, edpt, (flag & 32 ? 33 : 0)); + ret= Xorriso_restore_sorted(xorriso, 1, eopt, edpt, &problem_count, + (flag & 32 ? 33 : 0)); if(!(flag&2)) Xorriso_pacifier_callback(xorriso, "files restored",xorriso->pacifier_count, xorriso->pacifier_total, "", 1|4); - if(ret<=0) + if(ret <= 0 || problem_count > 0) goto ex; if(!(flag&1)) { @@ -1346,7 +1347,7 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag) " -load \"session\"|\"track\"|\"lba\"|\"sbsector\"|\"volid\"|\"auto\" id", " Load a particular (outdated) ISO image from a -dev or", " -indev which hosts more than one session.", -" -displacement [-]lba", +" -displacement [-]block_address", " When loading ISO tree or reading data files compensate a", " displacement versus the start address for which the image", " was prepared.", diff --git a/libisoburn/trunk/xorriso/opts_i_o.c b/libisoburn/trunk/xorriso/opts_i_o.c index a0833b33..ce35d390 100644 --- a/libisoburn/trunk/xorriso/opts_i_o.c +++ b/libisoburn/trunk/xorriso/opts_i_o.c @@ -451,7 +451,7 @@ int Xorriso_option_map(struct XorrisO *xorriso, char *disk_path, int Xorriso_option_map_l(struct XorrisO *xorriso, int argc, char **argv, int *idx, int flag) { - int ret, end_idx, optc= 0, was_failure= 1, i, fret, mode; + int ret, end_idx, optc= 0, was_failure= 1, i, fret, mode, problem_count; int ns_flag= 2|4, nt_flag= 2, opt_args_flag= 2, made_di_array= 0; char source_prefix[SfileadrL], target_prefix[SfileadrL], *cmd, **optv= NULL; char eff_source[SfileadrL], eff_target[SfileadrL], *source_pt, *s_wd, *t_wd; @@ -576,7 +576,10 @@ int Xorriso_option_map_l(struct XorrisO *xorriso, int argc, char **argv, source_prefix, strlen(source_prefix) + 1, 0); if(ret <= 0) goto ex; - ret= Xorriso_restore_sorted(xorriso, optc, eff_src_array, eff_tgt_array, 0); + ret= Xorriso_restore_sorted(xorriso, optc, eff_src_array, eff_tgt_array, + &problem_count, 0); + if(ret <= 0 || problem_count > 0) + was_failure= 1; } if(mode==0) Xorriso_pacifier_callback(xorriso, "files added", xorriso->pacifier_count, diff --git a/libisoburn/trunk/xorriso/xorriso_timestamp.h b/libisoburn/trunk/xorriso/xorriso_timestamp.h index 665e3d24..fb54255a 100644 --- a/libisoburn/trunk/xorriso/xorriso_timestamp.h +++ b/libisoburn/trunk/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2010.11.30.094310" +#define Xorriso_timestamP "2010.11.30.104719"