Bug fix: -findi operated on nodes which ceased existence shortly before

This commit is contained in:
Thomas Schmitt 2008-05-18 08:02:23 +00:00
parent 11ccdf7555
commit a4615cff1a
3 changed files with 38 additions and 9 deletions

View File

@ -7246,7 +7246,7 @@ ex:;
/* @param boss_iter Opaque handle to be forwarded to actions in ISO image /* @param boss_iter Opaque handle to be forwarded to actions in ISO image
Set to NULL if calling this function from outside ISO world Set to NULL if calling this function from outside ISO world
@param flag bit2= -follow: this is not a command parameter @param flag bit2= -follow: this is not a command parameter
@return <=0 error, 1= ok , 2= iso_rr_path has been deleted , @return <=0 error, 1= ok , 2= iso_rr_path node object has been deleted ,
3= no action taken 3= no action taken
*/ */
int Xorriso_update_interpreter(struct XorrisO *xorriso, void *boss_iter, int Xorriso_update_interpreter(struct XorrisO *xorriso, void *boss_iter,
@ -7337,6 +7337,7 @@ delete:;
ret= Xorriso_rmi(xorriso, NULL, (off_t) 0, part_path, 1); ret= Xorriso_rmi(xorriso, NULL, (off_t) 0, part_path, 1);
if(ret<=0) if(ret<=0)
goto ex; goto ex;
deleted= 1;
} else { } else {
partno= i+1; partno= i+1;
offset= i*first_bytes; offset= i*first_bytes;
@ -7359,9 +7360,12 @@ delete:;
ret= Xorriso_copy_properties(xorriso, disk_path, iso_rr_path, 2); ret= Xorriso_copy_properties(xorriso, disk_path, iso_rr_path, 2);
if(ret<=0) if(ret<=0)
goto ex; goto ex;
} else } else {
ret= Xorriso_graft_in(xorriso, boss_iter, disk_path, iso_rr_path, ret= Xorriso_graft_in(xorriso, boss_iter, disk_path, iso_rr_path,
(off_t) 0, (off_t) 0, 2|(flag&4)); (off_t) 0, (off_t) 0, 2|(flag&4));
if(ret>0 && !(compare_result&2))
deleted= 1;
}
sprintf(xorriso->info_text, "Added/overwrote "); sprintf(xorriso->info_text, "Added/overwrote ");
} else if(compare_result&(4|16|32|256|512|1024)) { } else if(compare_result&(4|16|32|256|512|1024)) {

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.05.17.170001" #define Xorriso_timestamP "2008.05.18.070001"

View File

@ -4605,7 +4605,7 @@ int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job,
IsoDirIter *iter= NULL; IsoDirIter *iter= NULL;
IsoDir *dir_node= NULL; IsoDir *dir_node= NULL;
IsoNode *node, *iso_node; IsoNode *node, *iso_node;
IsoImage *volume; IsoImage *volume= NULL;
struct stat stbuf; struct stat stbuf;
char *name; char *name;
off_t mem; off_t mem;
@ -4641,7 +4641,6 @@ int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job,
if(ret<=0) if(ret<=0)
{ret= 0; goto ex;} {ret= 0; goto ex;}
ret= Xorriso_fake_stbuf(xorriso, "", dir_stbuf, &iso_node, 1); ret= Xorriso_fake_stbuf(xorriso, "", dir_stbuf, &iso_node, 1);
dir_node= (IsoDir *) iso_node;
if(ret<=0) if(ret<=0)
goto ex; goto ex;
@ -4661,8 +4660,18 @@ int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job,
if(ret<=0) if(ret<=0)
goto ex; goto ex;
if(ret==2) { if(ret==2) {
deleted= 1; /* re-determine dir_node in case it has a new persona */
goto ex; ret= Xorriso_node_from_path(xorriso, volume, path, &iso_node, 1);
if(ret==0) {
deleted= 1;
{ret= 2; goto ex;}
}
if(ret<0)
{ret= 0; goto ex;}
dir_node= (IsoDir *) iso_node;
ret= Xorriso_fake_stbuf(xorriso, "", dir_stbuf, &iso_node, 1);
if(ret<=0)
goto ex;
} }
if(ret==3) if(ret==3)
no_dive= 1; no_dive= 1;
@ -4673,7 +4682,7 @@ int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job,
mem= boss_mem; mem= boss_mem;
hflag= 1; hflag= 1;
if(action==1 || action==2 || action==3 || action==14) if(action==1 || action==2 || action==3 || action==17)
hflag|= 2; /* need freedom to manipulate image */ hflag|= 2; /* need freedom to manipulate image */
if(action==14 || action==17) if(action==14 || action==17)
hflag|= 4; /* need LBA sorted iteration for good data reading performance */ hflag|= 4; /* need LBA sorted iteration for good data reading performance */
@ -4714,8 +4723,24 @@ int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job,
goto ex; goto ex;
ret= Xorriso_findi_action(xorriso, job, iter, mem, ret= Xorriso_findi_action(xorriso, job, iter, mem,
abs_path, path, node, depth, 1|(flag&2)); abs_path, path, node, depth, 1|(flag&2));
if(ret==2) /* node has been deleted */ if(ret==2) { /* node has been deleted */
/* re-determine node in case it has a new persona */
if(volume==NULL) {
ret= Xorriso_get_volume(xorriso, &volume, 0);
if(ret<=0)
{ret= -1; goto ex;}
}
ret= Xorriso_node_from_path(xorriso, volume, abs_path, &node, 1);
if(ret==0)
continue; continue;
if(ret<0)
{ret= 0; goto ex;}
ret= Xorriso_fake_stbuf(xorriso, "", &stbuf, &node, 1);
if(ret<0)
goto ex;
if(ret==0)
continue;
}
no_dive= (ret==3); no_dive= (ret==3);
if(ret<=0) { if(ret<=0) {
if(Xorriso_eval_problem_status(xorriso, ret, 1|2)<0) if(Xorriso_eval_problem_status(xorriso, ret, 1|2)<0)