Hopefully completed -cdx
This commit is contained in:
@ -431,6 +431,7 @@ int Xorriso_get_volume(struct XorrisO *xorriso, struct iso_volume **volume,
|
||||
/* @param eff_path returns resulting effective path.
|
||||
Must provide at least SfileadrL bytes of storage.
|
||||
@param flag bit0= do not produce problem events (unless internal error)
|
||||
bit1= work purely literally, do not use libisofs
|
||||
@return <0 = internal error , 0 = not found ,
|
||||
1 = found simple node , 2 = found directory
|
||||
*/
|
||||
@ -443,9 +444,11 @@ int Xorriso_normalize_img_path(struct XorrisO *xorriso, char *img_path,
|
||||
struct iso_tree_node *node= NULL;
|
||||
char path[SfileadrL], *apt, *npt, sfe[4*SfileadrL], *cpt;
|
||||
|
||||
ret= Xorriso_get_volume(xorriso, &volume, 0);
|
||||
if(ret<=0)
|
||||
return(ret);
|
||||
if(!(flag&2)) {
|
||||
ret= Xorriso_get_volume(xorriso, &volume, 0);
|
||||
if(ret<=0)
|
||||
return(ret);
|
||||
}
|
||||
|
||||
if(Sfile_str(path, img_path, 0)<=0)
|
||||
return(-1);
|
||||
@ -479,50 +482,48 @@ int Xorriso_normalize_img_path(struct XorrisO *xorriso, char *img_path,
|
||||
if(strcmp(apt,".")==0)
|
||||
continue;
|
||||
if(strcmp(apt,"..")==0) {
|
||||
node= (struct iso_tree_node *) dir;
|
||||
if(node==NULL) {
|
||||
sprintf(xorriso->info_text,
|
||||
"Relative addressing in path exceeds root directory: %s",
|
||||
Text_shellsafe(path, sfe, 0));
|
||||
if(!(flag&1))
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||
return(0);
|
||||
if(!(flag&2)) {
|
||||
node= (struct iso_tree_node *) dir;
|
||||
if(node==NULL) {
|
||||
bonked_root:;
|
||||
sprintf(xorriso->info_text,
|
||||
"Relative addressing in path exceeds root directory: %s",
|
||||
Text_shellsafe(path, sfe, 0));
|
||||
if(!(flag&1))
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||
return(0);
|
||||
}
|
||||
dir= iso_tree_node_get_parent(node);
|
||||
}
|
||||
dir= iso_tree_node_get_parent(node);
|
||||
|
||||
/* truncate eff_path */;
|
||||
cpt= strrchr(eff_path, '/');
|
||||
if(cpt==NULL) {
|
||||
sprintf(xorriso->info_text,
|
||||
"Internal error: less '/' than parent directories in %s",
|
||||
Text_shellsafe(img_path, sfe, 0));
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0);
|
||||
return(-1);
|
||||
}
|
||||
if(cpt==NULL) /* ??? if not flag&2 then this is a bug */
|
||||
goto bonked_root;
|
||||
*cpt= 0;
|
||||
continue;
|
||||
}
|
||||
ret= Sfile_add_to_path(eff_path, apt, 0);
|
||||
if(ret<=0) {
|
||||
sprintf(xorriso->info_text,
|
||||
"Effective path in ISO image gets much too long (%d)",
|
||||
sprintf(xorriso->info_text, "Effective path gets much too long (%d)",
|
||||
strlen(eff_path)+strlen(apt)+1);
|
||||
if(!(flag&1))
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||
return(0);
|
||||
}
|
||||
dir= (struct iso_tree_node_dir *) node;
|
||||
node= iso_tree_volume_path_to_node(volume,eff_path);
|
||||
if(node==NULL) {
|
||||
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);
|
||||
if(!(flag&2)) {
|
||||
dir= (struct iso_tree_node_dir *) node;
|
||||
node= iso_tree_volume_path_to_node(volume,eff_path);
|
||||
if(node==NULL) {
|
||||
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);
|
||||
}
|
||||
if(dir==NULL) /* could be false with "/dir/.." */
|
||||
dir= iso_tree_node_get_parent(node);
|
||||
is_dir= LIBISO_ISDIR(node);
|
||||
}
|
||||
if(dir==NULL) /* could be false with "/dir/.." */
|
||||
dir= iso_tree_node_get_parent(node);
|
||||
is_dir= LIBISO_ISDIR(node);
|
||||
}
|
||||
return(1+!!is_dir);
|
||||
}
|
||||
|
Reference in New Issue
Block a user