From 54bf7b64c77fbb53576968814ba1745ffa1c8f4d Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Mon, 15 Oct 2007 20:37:53 +0000 Subject: [PATCH] Corrected image path bug with -add of regular files, and -add /=/some/dir --- test/xorriso_timestamp.h | 2 +- test/xorrisoburn.c | 48 +++++++++++++++++++++++++++++++++++----- 2 files changed, 43 insertions(+), 7 deletions(-) diff --git a/test/xorriso_timestamp.h b/test/xorriso_timestamp.h index 3d48c192..1f318ca0 100644 --- a/test/xorriso_timestamp.h +++ b/test/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2007.10.15.203554" +#define Xorriso_timestamP "2007.10.15.203714" diff --git a/test/xorrisoburn.c b/test/xorrisoburn.c index 6cfd94d6..fac37c6b 100644 --- a/test/xorrisoburn.c +++ b/test/xorrisoburn.c @@ -314,9 +314,21 @@ int Xorriso_graft_in(struct XorrisO *xorriso, char *disk_path, char *img_path, char path[SfileadrL], *apt, *npt; struct iso_tree_node_dir *dir; struct iso_tree_node *node; - int done= 0, is_dir= 0; + int done= 0, is_dir= 0, l; struct stat stbuf; + if(xorriso->in_volset_handle==NULL) { + + /* >>> */ + fprintf(stderr, "--- No volset is loaded.\n"); + if(xorriso->indev[0]==0) + fprintf(stderr, "--- No -dev or -indev is selected.\n"); + else + fprintf(stderr, "--- Possible program error with drive '%s'\n", + xorriso->indev); + + return(0); + } strncpy(path, img_path, sizeof(path)-1); path[sizeof(path)-1]= 0; apt= npt= path; @@ -331,8 +343,8 @@ int Xorriso_graft_in(struct XorrisO *xorriso, char *disk_path, char *img_path, return(0); } - if(S_ISDIR(stbuf.st_mode)) - is_dir= 1; + if(S_ISDIR(stbuf.st_mode)) + is_dir= 1; else if(!(S_ISREG(stbuf.st_mode) || S_ISLNK(stbuf.st_mode))) { /* >>> */ @@ -340,6 +352,19 @@ int Xorriso_graft_in(struct XorrisO *xorriso, char *disk_path, char *img_path, disk_path); return(0); + } else { + l= strlen(img_path); + if(l>0) + if(img_path[l-1]=='/') + l= 0; + if(l==0) { + + /* >>> */ + fprintf(stderr, + "--- Source '%s' is not a directory. Target '%s' would be.\n", + disk_path, img_path); + + } } dir= iso_volume_get_root(volume); @@ -361,20 +386,29 @@ int Xorriso_graft_in(struct XorrisO *xorriso, char *disk_path, char *img_path, if(*apt==0) { *apt= '/'; apt++; + if(done) + goto attach_source; continue; } node= iso_tree_volume_path_to_node(volume,path); if(node!=NULL) { if(iso_tree_node_get_type(node)!=LIBISO_NODE_DIR) { + if(done) { + + /* >>> handle overwrite situation */; + + } + /* >>> */ - fprintf(stderr, "--- While grafting '%s' : '%s' is not a directory\n", - img_path, path); + fprintf(stderr, + "--- While grafting '%s' : '%s' exists and is not a directory\n", + img_path, path); return(0); } dir= (struct iso_tree_node_dir *) node; - } else { + } else if(is_dir || !done) { dir= iso_tree_add_dir(dir, apt); if(dir==NULL) { @@ -386,6 +420,7 @@ int Xorriso_graft_in(struct XorrisO *xorriso, char *disk_path, char *img_path, } } if(done) { +attach_source:; if(is_dir) { iso_tree_radd_dir(dir, disk_path, &behav); } else { @@ -398,6 +433,7 @@ int Xorriso_graft_in(struct XorrisO *xorriso, char *disk_path, char *img_path, return(0); } + iso_tree_node_set_name(node, apt); } } else *npt= '/';