Bug fix: -as mkisofs did not unescape "\=" in the source part of pathspecs

This commit is contained in:
2015-12-09 13:28:06 +00:00
parent 4b4bf14b05
commit bafcf288f9
10 changed files with 300 additions and 169 deletions

View File

@ -154,14 +154,17 @@ int Xorriso_option_paste_in(struct XorrisO *xorriso, char *iso_rr_path,
/* Option -path_list , -quoted_path_list */
/* @param flag bit0= -quoted_path_list */
/* @param flag bit0= -quoted_path_list
bit1= mkisofs mode: Use / as target for pathspecs without =
*/
int Xorriso_option_path_list(struct XorrisO *xorriso, char *adr, int flag)
{
int ret,linecount= 0, insertcount= 0, null= 0, was_failure= 0, fret= 0;
int was_ferror= 0, argc= 0, i;
int was_ferror= 0, argc= 0, i, allow_graft_points_mem;
FILE *fp= NULL;
char **argv= NULL;
char **argv= NULL, *pathspec= NULL;
allow_graft_points_mem= xorriso->allow_graft_points;
Xorriso_pacifier_reset(xorriso, 0);
if(adr[0]==0) {
sprintf(xorriso->info_text,"Empty file name given with %s",
@ -172,6 +175,8 @@ int Xorriso_option_path_list(struct XorrisO *xorriso, char *adr, int flag)
ret= Xorriso_afile_fopen(xorriso, adr, "rb", &fp, 0);
if(ret <= 0)
return(0);
Xorriso_alloc_meM(pathspec, char, 2 * SfileadrL);
while(1) {
ret= Xorriso_read_lines(xorriso, fp, &linecount, &argc, &argv,
4 | (flag & 1) );
@ -183,7 +188,16 @@ int Xorriso_option_path_list(struct XorrisO *xorriso, char *adr, int flag)
if(argv[i][0] == 0)
continue;
null= 0;
ret= Xorriso_option_add(xorriso, 1, argv + i, &null, 1|2);
if(flag & 2) {
ret= Xorriso_graftable_pathspec(xorriso, argv[i], pathspec, 0);
if(ret <= 0)
goto problem_handler;
xorriso->allow_graft_points= 3;
ret= Xorriso_option_add(xorriso, 1, &pathspec, &null, 1 | 2);
xorriso->allow_graft_points= allow_graft_points_mem;
} else {
ret= Xorriso_option_add(xorriso, 1, argv + i, &null, 1 | 2);
}
if(ret<=0 || xorriso->request_to_abort)
goto problem_handler;
insertcount++;
@ -201,6 +215,9 @@ problem_handler:;
}
ret= 1;
ex:;
xorriso->allow_graft_points= allow_graft_points_mem;
Sfile_make_argv("", "", &argc, &argv, 2);
Xorriso_free_meM(pathspec);
if(flag & 1)
Xorriso_read_lines(xorriso, fp, &linecount, &argc, &argv, 2);
@ -234,6 +251,8 @@ int Xorriso_option_pathspecs(struct XorrisO *xorriso, char *mode, int flag)
xorriso->allow_graft_points= 0;
else if(strcmp(mode, "on")==0)
xorriso->allow_graft_points= 1;
else if(strcmp(mode, "as_mkisofs")==0)
xorriso->allow_graft_points= 3;
else {
sprintf(xorriso->info_text, "-pathspecs: unknown mode '%s'", mode);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);