Fixed bug about non existing disk_path with -update_r

This commit is contained in:
2008-03-06 17:48:02 +00:00
parent 4188398e1d
commit ba659b5d8a
4 changed files with 75 additions and 45 deletions

View File

@ -4495,12 +4495,13 @@ I thought to have seen a libisofs bug here but it seems that it was an illusion
Set to NULL if calling this function from outside ISO world
@param flag bit0= update rather than compare
bit1= find[ix] is in recursion
@return <=0 error, 1= ok , 2= iso_path was deleted
*/
int Xorriso_find_compare(struct XorrisO *xorriso, void *boss_iter,
char *iso_path, char *iso_prefix, char *disk_prefix,
int flag)
{
int ret, result, uret, follow_links;
int ret, result, uret, follow_links, deleted= 0;
char disk_path[SfileadrL], adrc[SfileadrL];
if(strncmp(iso_path, iso_prefix, strlen(iso_prefix))!=0)
@ -4528,8 +4529,14 @@ int Xorriso_find_compare(struct XorrisO *xorriso, void *boss_iter,
disk_path, iso_path, (flag&2)<<1);
if(uret<=0)
ret= 0;
if(uret==2)
deleted= 1;
}
}
if(ret<0)
return(ret);
if(deleted)
return(2);
return(ret);
}
@ -7086,12 +7093,13 @@ ex:;
/* @param boss_iter Opaque handle to be forwarded to actions in ISO image
Set to NULL if calling this function from outside ISO world
@param flag bit2= -follow: this is not a command parameter
@return <=0 error, 1= ok , 2= iso_rr_path has been deleted
*/
int Xorriso_update_interpreter(struct XorrisO *xorriso, void *boss_iter,
int compare_result, char *disk_path,
char *iso_rr_path, int flag)
{
int ret;
int ret, deleted= 0;
char sfe[5*SfileadrL];
if(compare_result&((1<<11)|(1<<13))) {
@ -7104,25 +7112,20 @@ int Xorriso_update_interpreter(struct XorrisO *xorriso, void *boss_iter,
}
xorriso->info_text[0]= 0;
#ifdef NIX
if((compare_result&(8|64)) && !(compare_result&(1<<16)) ) {
/* <<< tolerate for now: disk_path being softlink to dir, iso being dir */
/* <<< to be obsoleted by proper link handling in compare_2_files */
/* file type, minor+major with device file */
#else
if(compare_result&(8|64)) {
/* file type, minor+major with device file */
#endif /* NIX */
ret= Xorriso_rmi(xorriso, boss_iter, iso_rr_path, 1); /* rm_r */
if(ret>0)
if(ret>0) {
deleted= 1;
ret= Xorriso_graft_in(xorriso, boss_iter, disk_path, iso_rr_path,
2|(flag&4));
}
sprintf(xorriso->info_text, "Deleted and re-added ");
} else if(compare_result&(1)) {
/* disk_adr not existing */
ret= Xorriso_rmi(xorriso, boss_iter, iso_rr_path, 1);
deleted= 1;
sprintf(xorriso->info_text, "Deleted ");
} else if(compare_result&(2|128|(1<<12)|(1<<14)|(1<<15))) {
@ -7143,7 +7146,11 @@ int Xorriso_update_interpreter(struct XorrisO *xorriso, void *boss_iter,
strcat(xorriso->info_text, Text_shellsafe(iso_rr_path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "UPDATE", 0);
}
return(ret);
if(ret<=0)
return(ret);
if(deleted)
return(2);
return(1);
}
@ -10053,7 +10060,8 @@ int Xorriso_option_update(struct XorrisO *xorriso, char *disk_path,
ret= xorriso->find_compare_result;
else
ret= -1;
}
} else
ret= xorriso->find_compare_result;
} else
ret= -1;
} else {