From a4615cff1a74b448ce2245ea2ff95cb4124206dc Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sun, 18 May 2008 08:02:23 +0000 Subject: [PATCH] Bug fix: -findi operated on nodes which ceased existence shortly before --- .../branches/ZeroOneSix/xorriso/xorriso.c | 8 +++- .../ZeroOneSix/xorriso/xorriso_timestamp.h | 2 +- .../branches/ZeroOneSix/xorriso/xorrisoburn.c | 37 ++++++++++++++++--- 3 files changed, 38 insertions(+), 9 deletions(-) diff --git a/libisoburn/branches/ZeroOneSix/xorriso/xorriso.c b/libisoburn/branches/ZeroOneSix/xorriso/xorriso.c index 628b53f3..2d0fcf02 100644 --- a/libisoburn/branches/ZeroOneSix/xorriso/xorriso.c +++ b/libisoburn/branches/ZeroOneSix/xorriso/xorriso.c @@ -7246,7 +7246,7 @@ 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 , + @return <=0 error, 1= ok , 2= iso_rr_path node object has been deleted , 3= no action taken */ 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); if(ret<=0) goto ex; + deleted= 1; } else { partno= i+1; offset= i*first_bytes; @@ -7359,9 +7360,12 @@ delete:; ret= Xorriso_copy_properties(xorriso, disk_path, iso_rr_path, 2); if(ret<=0) goto ex; - } else + } else { ret= Xorriso_graft_in(xorriso, boss_iter, disk_path, iso_rr_path, (off_t) 0, (off_t) 0, 2|(flag&4)); + if(ret>0 && !(compare_result&2)) + deleted= 1; + } sprintf(xorriso->info_text, "Added/overwrote "); } else if(compare_result&(4|16|32|256|512|1024)) { diff --git a/libisoburn/branches/ZeroOneSix/xorriso/xorriso_timestamp.h b/libisoburn/branches/ZeroOneSix/xorriso/xorriso_timestamp.h index b21f3f50..5a7f3527 100644 --- a/libisoburn/branches/ZeroOneSix/xorriso/xorriso_timestamp.h +++ b/libisoburn/branches/ZeroOneSix/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2008.05.17.170001" +#define Xorriso_timestamP "2008.05.18.070001" diff --git a/libisoburn/branches/ZeroOneSix/xorriso/xorrisoburn.c b/libisoburn/branches/ZeroOneSix/xorriso/xorrisoburn.c index 0f63bc4f..059ba7b3 100644 --- a/libisoburn/branches/ZeroOneSix/xorriso/xorrisoburn.c +++ b/libisoburn/branches/ZeroOneSix/xorriso/xorrisoburn.c @@ -4605,7 +4605,7 @@ int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job, IsoDirIter *iter= NULL; IsoDir *dir_node= NULL; IsoNode *node, *iso_node; - IsoImage *volume; + IsoImage *volume= NULL; struct stat stbuf; char *name; off_t mem; @@ -4641,7 +4641,6 @@ int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job, if(ret<=0) {ret= 0; goto ex;} ret= Xorriso_fake_stbuf(xorriso, "", dir_stbuf, &iso_node, 1); - dir_node= (IsoDir *) iso_node; if(ret<=0) goto ex; @@ -4661,8 +4660,18 @@ int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job, if(ret<=0) goto ex; if(ret==2) { - deleted= 1; - goto ex; + /* re-determine dir_node in case it has a new persona */ + 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) no_dive= 1; @@ -4673,7 +4682,7 @@ int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job, mem= boss_mem; 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 */ if(action==14 || action==17) 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; ret= Xorriso_findi_action(xorriso, job, iter, mem, 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; + 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); if(ret<=0) { if(Xorriso_eval_problem_status(xorriso, ret, 1|2)<0)