From 8a5540c974c714d417eaa8200d5714a4728be2cb Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sun, 30 Nov 2008 12:37:26 +0000 Subject: [PATCH] Gave -as mkisofs problem handlers rather than to let it abort on any error --- xorriso/xorriso.c | 43 +++++++++++++++++++++++++------------ xorriso/xorriso_timestamp.h | 2 +- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/xorriso/xorriso.c b/xorriso/xorriso.c index 64c25f86..bdf6ec42 100644 --- a/xorriso/xorriso.c +++ b/xorriso/xorriso.c @@ -9199,7 +9199,7 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom, { int ret, i, was_path= 0, was_other_option= 0, mem_graft_points, mem; int do_print_size= 0, fd, idx, iso_level= 0, no_emul_boot= 0; - int option_b= 0; + int option_b= 0, was_failure= 0, fret; char sfe[5*SfileadrL], adr[SfileadrL+8], ra_text[80], pathspec[2*SfileadrL]; char *ept, *add_pt, eff_path[SfileadrL], indev[SfileadrL+8], msc[80], *cpt; @@ -9320,7 +9320,7 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom, } else if(strcmp(argv[i], "-f")==0 || strcmp(argv[i], "-follow-links")==0) { ret= Xorriso_option_follow(xorriso, "on", 0); if(ret<=0) - goto ex; + goto problem_handler_1; } else if(strcmp(argv[i], "-iso-level")==0) { if(i+1>=argc) goto not_enough_args; @@ -9331,7 +9331,7 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom, "-as %s: unsupported -iso-level '%s' (use one of: 1,2,3)", whom, argv[i]); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); - ret= 0; goto ex; + ret= 0; goto problem_handler_1; } if(iso_level < 3) xorriso->file_size_limit= @@ -9379,9 +9379,17 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom, sprintf(sfe, "isohybrid=%s", argv[i] + 13); ret= Xorriso_option_boot_image(xorriso, "isolinux", sfe, 0); if(ret <= 0) - goto ex; + goto problem_handler_1; } else was_other_option= 1; + + continue; /* regular bottom of loop */ +problem_handler_1:; + was_failure= 1; + fret= Xorriso_eval_problem_status(xorriso, ret, 1|2); + if(fret>=0) + continue; + goto ex; } Xorriso_option_report_about(xorriso, ra_text, 0); if(adr[0]) { @@ -9508,12 +9516,12 @@ not_enough_args:; ret= 0; goto ex; } i++; + was_path= 1; + xorriso->pacifier_style= 1; ret= Xorriso_option_path_list(xorriso, argv[i], (strcmp(argv[i-1], "--quoted_path_list")==0)); if(ret<=0) - goto ex; - was_path= 1; - xorriso->pacifier_style= 1; + goto problem_handler_2; } else if(strcmp(argv[i], "-f")==0 || strcmp(argv[i], "-follow-links")==0) { /* was already handled in first argument scan */; } else if(strcmp(argv[i], "-pad")==0) { @@ -9539,14 +9547,14 @@ not_enough_args:; i++; ret= Xorriso_option_volid(xorriso, argv[i], 0); if(ret<=0) - goto ex; + goto problem_handler_2; } else if(strcmp(argv[i], "-P")==0 || strcmp(argv[i], "-publisher")==0) { if(i+1>=argc) goto not_enough_args; i++; ret= Xorriso_option_publisher(xorriso, argv[i], 0); if(ret<=0) - goto ex; + goto problem_handler_2; } else if(strcmp(argv[i], "-m")==0 || strcmp(argv[i], "-exclude")==0 || strcmp(argv[i], "-x")==0 || strcmp(argv[i], "-old-exclude")==0) { if(i+1>=argc) @@ -9561,7 +9569,7 @@ not_enough_args:; ret= Xorriso_option_not_leaf(xorriso, argv[i], 0); xorriso->do_disk_pattern= mem; if(ret<=0) - goto ex; + goto problem_handler_2; } else if(strcmp(argv[i], "-exclude-list")==0) { if(i+1>=argc) goto not_enough_args; @@ -9571,7 +9579,7 @@ not_enough_args:; ret= Xorriso_option_not_list(xorriso, argv[i], 0); xorriso->do_disk_pattern= mem; if(ret<=0) - goto ex; + goto problem_handler_2; } else if(strcmp(argv[i], "-v")==0 || strcmp(argv[i], "-quiet")==0) { /* was already handled in first argument scan */; @@ -9608,7 +9616,7 @@ not_enough_args:; ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, argv[i], eff_path, 2|4); if(ret<=0) - goto ex; + goto problem_handler_2; ret= Sfile_type(eff_path, 1|((xorriso->do_follow_param||xorriso->do_follow_links)<<2)); if(ret==2) { @@ -9631,10 +9639,17 @@ not_enough_args:; ret= Xorriso_option_add(xorriso, 1, &add_pt, &zero, was_path<<1); xorriso->allow_graft_points= mem_graft_points; if(ret<=0) - goto ex; + goto problem_handler_2; was_path= 1; xorriso->pacifier_style= 1; } + continue; /* regular bottom of loop */ +problem_handler_2:; + was_failure= 1; + fret= Xorriso_eval_problem_status(xorriso, ret, 1|2); + if(fret>=0) + continue; + goto ex; } if(do_print_size) { ret= Xorriso_option_print_size(xorriso, 1); @@ -9642,7 +9657,7 @@ not_enough_args:; goto ex; } - ret= 1; + ret= !was_failure; ex:; if(was_path && !do_print_size) Xorriso_pacifier_callback(xorriso, "files added", xorriso->pacifier_count, diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index b8c26369..e0dda36f 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2008.11.30.095007" +#define Xorriso_timestamP "2008.11.30.123700"