Removed old and new bugs

This commit is contained in:
2008-01-11 13:37:26 +00:00
parent 2b48ad6f72
commit 90c129679a
4 changed files with 111 additions and 105 deletions

View File

@@ -623,6 +623,31 @@ int Xorriso_get_volume(struct XorrisO *xorriso, IsoImage **volume,
}
/* @param flag bit0=do not complain about non existent node */
int Xorriso_node_from_path(struct XorrisO *xorriso, IsoImage *volume,
char *path, IsoNode **node, int flag)
{
int ret;
char sfe[5*SfileadrL], *path_pt;
path_pt= path;
if(path[0]==0)
path_pt= "/";
*node= NULL;
ret= iso_tree_path_to_node(volume, path_pt, node);
Xorriso_process_msg_queues(xorriso,0);
if(ret<=0) {
if(!(flag&1)) {
sprintf(xorriso->info_text, "Cannot find path %s in loaded ISO image",
Text_shellsafe(path_pt, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
}
return(0);
}
return(1);
}
/* @param eff_path returns resulting effective path.
Must provide at least SfileadrL bytes of storage.
@param flag bit0= do not produce problem events (unless faulty path format)
@@ -696,11 +721,7 @@ bonked_root:;
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
return(-1);
}
/* >>> NG
dir= iso_tree_node_get_parent(node);
*/
dir= iso_node_get_parent(node);
}
/* truncate eff_path */;
cpt= strrchr(eff_path, '/');
@@ -720,18 +741,11 @@ much_too_long:;
}
if(!(flag&2)) {
dir= (IsoDir *) node;
ret= iso_tree_path_to_node(volume, eff_path, &node);
if(ret<=0) {
sprintf(xorriso->info_text, "Cannot find in ISO image: %s",
Text_shellsafe(eff_path, sfe, 0));
if(!(flag&1))
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
return(0);
}
ret= Xorriso_node_from_path(xorriso, volume, eff_path, &node, flag&1);
if(ret<=0)
return(0);
if(dir==NULL) /* could be false with "/dir/.." */
/* >>> NG dir= iso_tree_node_get_parent(node) */ ;
dir= iso_node_get_parent(node);
is_dir= LIBISO_ISDIR(node);
}
}
@@ -744,7 +758,7 @@ int Xorriso_get_node_by_path(struct XorrisO *xorriso,
IsoNode **node, int flag)
{
int ret;
char sfe[5*SfileadrL], path[SfileadrL];
char path[SfileadrL];
IsoImage *volume;
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, in_path, path, 0);
@@ -755,13 +769,9 @@ int Xorriso_get_node_by_path(struct XorrisO *xorriso,
ret= Xorriso_get_volume(xorriso, &volume, 0);
if(ret<=0)
return(ret);
ret= iso_tree_path_to_node(volume,path,node);
if(ret<=0) {
sprintf(xorriso->info_text, "Not found in ISO image: %s",
Text_shellsafe(path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
ret= Xorriso_node_from_path(xorriso, volume, path, node, 0);
if(ret<=0)
return(0);
}
return(1);
}
@@ -922,7 +932,7 @@ cannot_lstat:;
/* does a node exist with this name ? */
node= NULL;
ret= iso_tree_path_to_node(volume, img_path, &node);
ret= Xorriso_node_from_path(xorriso, volume, img_path, &node, 1);
if(ret>0) {
target_is_dir= LIBISO_ISDIR(node);
if(!(target_is_dir && source_is_dir)) {
@@ -1125,10 +1135,8 @@ int Xorriso_graft_in(struct XorrisO *xorriso, char *disk_path, char *img_path,
continue;
}
source_is_dir= (is_dir || (flag&1) || !done);
ret= iso_tree_path_to_node(volume, path, &node);
if(ret<=0) {
node= NULL;
} else {
ret= Xorriso_node_from_path(xorriso, volume, path, &node, 0);
if(ret>0) {
target_is_dir= LIBISO_ISDIR(node);
if(!(target_is_dir && source_is_dir)) {
Xorriso_process_msg_queues(xorriso,0);
@@ -1657,24 +1665,6 @@ int Xorriso_format_media(struct XorrisO *xorriso, int flag)
}
int Xorriso_node_from_path(struct XorrisO *xorriso, IsoImage *volume,
char *path, IsoNode **node, int flag)
{
int ret;
char sfe[5*SfileadrL];
ret= iso_tree_path_to_node(volume, path, node);
Xorriso_process_msg_queues(xorriso,0);
if(ret<=0) {
sprintf(xorriso->info_text, "Cannot find path %s in loaded ISO image",
Text_shellsafe(path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
return(0);
}
return(1);
}
/* @param boss_iter If not NULL then this is an iterator suitable for
iso_dir_iter_remove() which is then to be used instead
of iso_node_remove().
@@ -1807,11 +1797,7 @@ dir_not_removed:;
if(xorriso->request_to_abort)
{ret= 3; goto ex;}
/* >>> NG
boss_node= iso_tree_node_get_parent(victim_node);
*/
boss_node= iso_node_get_parent(victim_node);
Xorriso_process_msg_queues(xorriso,0);
if(boss_node==NULL) {
sprintf(xorriso->info_text,
@@ -2123,9 +2109,9 @@ int Xorriso_fake_stbuf(struct XorrisO *xorriso, char *path, struct stat *stbuf,
ret= Xorriso_get_volume(xorriso, &volume, 0);
if(ret<=0)
return(-1);
ret= iso_tree_path_to_node(volume, path, node);
ret= Xorriso_node_from_path(xorriso, volume, path, node, 1);
if(ret<=0)
node= NULL;
*node= NULL;
}
if(*node==NULL)
return(0);
@@ -2266,12 +2252,12 @@ int Xorriso_ls_filev(struct XorrisO *xorriso, char *wd,
/* Count valid nodes, warn of invalid ones */
for(i= 0; i<filec; i++) {
ret= Xorriso_make_abs_adr(xorriso, wd, filev[i], path, 1|4);
ret= Xorriso_make_abs_adr(xorriso, wd, filev[i], path, 1|2|4);
if(ret<=0) {
was_error++;
continue;
}
ret= iso_tree_path_to_node(volume, path, &node);
ret= Xorriso_node_from_path(xorriso, volume, path, &node, 1);
if(ret<=0) {
sprintf(xorriso->info_text, "Not found in ISO image: %s",
Text_shellsafe(path, sfe, 0));
@@ -2292,7 +2278,7 @@ int Xorriso_ls_filev(struct XorrisO *xorriso, char *wd,
for(pass= 0; pass<passes; pass++)
for(i= 0; i<filec && !(xorriso->request_to_abort); i++) {
rpt[0]= 0;
ret= Xorriso_make_abs_adr(xorriso, wd, filev[i], path, 1|4);
ret= Xorriso_make_abs_adr(xorriso, wd, filev[i], path, 1|2|4);
if(ret<=0)
continue;
ret= Xorriso_fake_stbuf(xorriso, path, &stbuf, &node, 0);
@@ -2571,20 +2557,14 @@ int Xorriso_rename(struct XorrisO *xorriso, char *origin, char *dest, int flag)
ret= Xorriso_get_volume(xorriso, &volume, 0);
if(ret<=0)
return(ret);
ret= iso_tree_path_to_node(volume, dir_adr, (IsoNode **) &dest_dir);
if(ret<=0)
dest_dir= NULL;
Xorriso_node_from_path(xorriso, volume, dir_adr, (IsoNode **) &dest_dir, 0);
strcpy(dir_adr, eff_origin);
cpt= strrchr(dir_adr, '/');
if(cpt==NULL)
cpt= dir_adr+strlen(dir_adr);
*cpt= 0;
ret= iso_tree_path_to_node(volume, dir_adr, (IsoNode **) &origin_dir);
if(ret<=0)
origin_dir= NULL;
ret= iso_tree_path_to_node(volume, eff_origin, &node);
if(ret<=0)
node= NULL;
Xorriso_node_from_path(xorriso, volume, dir_adr, (IsoNode **) &origin_dir, 0);
Xorriso_node_from_path(xorriso, volume, eff_origin, &node, 0);
if(dest_dir==NULL || origin_dir==NULL || node==NULL) {
Xorriso_process_msg_queues(xorriso,0);
sprintf(xorriso->info_text,
@@ -2790,8 +2770,9 @@ int Xorriso_expand_pattern(struct XorrisO *xorriso,
It is not an error if xorriso->wdi does not exist yet, but one may
not use it as base for relative address searches.
*/
ret= iso_tree_path_to_node(volume, xorriso->wdi, (IsoNode **) &dir);
if(ret<0) {
ret= Xorriso_node_from_path(xorriso, volume,
xorriso->wdi, (IsoNode **) &dir, 1);
if(ret<=0) {
Xorriso_process_msg_queues(xorriso,0);
sprintf(xorriso->info_text,
"While expanding pattern %s : Working directory does not exist in ISO image",
@@ -3033,7 +3014,7 @@ int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job,
ret= Xorriso_make_abs_adr(xorriso, xorriso->wdi, dir_path, path, 1|2|4);
if(ret<=0)
goto ex;
ret= iso_tree_path_to_node(volume, path, (IsoNode **) &dir_node);
ret= Xorriso_node_from_path(xorriso, volume, path,(IsoNode **) &dir_node,0);
if(ret<=0)
{ret= 0; goto ex;}
ret= Xorriso_fake_stbuf(xorriso, "", dir_stbuf,