Fixed bug about non existing disk_path with -update_r

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

View File

@ -3786,13 +3786,14 @@ int Xorriso_set_time(struct XorrisO *xorriso, char *in_path, time_t t,
/* @param flag bit0= not a command parameter (directory iteration or recursion)
bit1= do not count deleted files with rm and rm_r
@return <=0 error, 1=ok, 2=ok, node has been deleted
*/
int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
IsoDirIter *boss_iter, off_t boss_mem,
char *abs_path, char *show_path,
IsoNode *node, int depth, int flag)
{
int ret= 0, type, action= 0, hflag;
int ret= 0, type, action= 0, hflag, deleted= 0;
uid_t user= 0;
gid_t group= 0;
time_t date= 0;
@ -3813,9 +3814,11 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
if(S_ISDIR(dir_stbuf.st_mode))
hflag= 2;
ret= Xorriso_rmi(xorriso, boss_iter, abs_path, hflag);
deleted= 1;
}
} else if(action==2) { /* rm_r */
ret= Xorriso_rmi(xorriso, boss_iter, abs_path, 1|hflag);
deleted= 1;
} else if(action==3) {
/* >>> mv target */;
@ -3838,6 +3841,8 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
Findjob_get_start_path(job, &iso_prefix, 0);
ret= Xorriso_find_compare(xorriso, (void *) boss_iter, abs_path,
iso_prefix, target, (action==17)|((flag&1)<<1));
if(ret==2)
deleted= 1;
if(ret>=0)
ret= 1;
} else if(action==16 || action==18) { /* not_in_iso , add_missing */
@ -3847,7 +3852,11 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
Xorriso_result(xorriso, 0);
ret= 1;
}
return(ret);
if(ret<=0)
return(ret);
if(deleted)
return(2);
return(1);
}
@ -3976,13 +3985,14 @@ cannot_iter:;
/* @param flag bit0= recursion
bit1= do not count deleted files with rm and rm_r
@return <=0 error, 1= ok , 2= dir node and path has been deleted
*/
int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job,
void *boss_iter, off_t boss_mem,
void *dir_node_generic, char *dir_path,
struct stat *dir_stbuf, int depth, int flag)
{
int ret, action= 0, hflag;
int ret, action= 0, hflag, deleted= 0;
IsoDirIter *iter= NULL;
IsoDir *dir_node= NULL;
IsoNode *node, *iso_node;
@ -4041,10 +4051,14 @@ int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job,
flag&(1|2));
if(ret<=0)
goto ex;
if(ret==2) {
deleted= 1;
goto ex;
}
}
}
if(!LIBISO_ISDIR((IsoNode *) dir_node))
{ret= 2; goto ex;}
{ret= 1; goto ex;}
mem= boss_mem;
hflag= 1;
@ -4074,6 +4088,10 @@ int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job,
if(ret==0)
continue;
/* ??? This seems to be redundant with the single test above
??? Should i dive in unconditionally and leave out test and action here ?
??? Then do above test unconditionally ?
*/
ret= Findjob_test(job, name, dir_stbuf, &stbuf, depth, 0);
if(ret<0)
goto ex;
@ -4083,6 +4101,8 @@ 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 */
continue;
if(ret<=0) {
if(Xorriso_eval_problem_status(xorriso, ret, 1|2)<0)
goto ex;
@ -4116,7 +4136,11 @@ ex:;
if(iter!=NULL)
iso_dir_iter_free(iter);
#endif
return(ret);
if(ret<=0)
return(ret);
if(deleted)
return(2);
return(1);
}