From 4e4b7897533a9e13583351c215be55c454026c84 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sat, 4 Sep 2010 10:08:55 +0000 Subject: [PATCH] This was obviously forgotten to commit with rev 3289 --- xorriso/iso_manip.c | 67 ++++++++++++++++++++++++++++++------- xorriso/xorriso_timestamp.h | 2 +- 2 files changed, 56 insertions(+), 13 deletions(-) diff --git a/xorriso/iso_manip.c b/xorriso/iso_manip.c index eeab8904..f3561aff 100644 --- a/xorriso/iso_manip.c +++ b/xorriso/iso_manip.c @@ -33,6 +33,7 @@ #include "iso_tree.h" #include "iso_manip.h" #include "sort_cmp.h" +#include "parse_exec.h" @@ -149,6 +150,8 @@ int Xorriso_graft_split(struct XorrisO *xorriso, IsoImage *volume, /* @param flag bit3= cut_out_node: offset and size are valid + bit8= hide in iso_rr + bit9= hide in joliet */ int Xorriso_tree_graft_node(struct XorrisO *xorriso, IsoImage *volume, IsoDir *dir, char *disk_path, char *img_name, @@ -199,7 +202,11 @@ int Xorriso_tree_graft_node(struct XorrisO *xorriso, IsoImage *volume, goto ex; } } - + if(flag & (256 | 512)) { + ret= Xorriso_set_hidden(xorriso, (void *) *node, "", (flag >> 8) & 3, 0); + if(ret <= 0) + goto ex; + } if(stbuf_valid && ((xorriso->do_aaip & 16) || !(xorriso->ino_behavior & 2))) { ret= Xorriso_record_dev_inode(xorriso, disk_path, stbuf.st_dev, stbuf.st_ino, (void *) *node, "", 1); @@ -224,6 +231,8 @@ ex:; bit1= do not report added files bit6= do not delete eventually existing node from di_array bit7= no special handling of split file directories + bit8= hide in iso_rr + bit9= hide in joliet */ int Xorriso_add_tree(struct XorrisO *xorriso, IsoDir *dir, char *img_dir_path, char *disk_dir_path, @@ -232,7 +241,7 @@ int Xorriso_add_tree(struct XorrisO *xorriso, IsoDir *dir, IsoImage *volume; IsoNode *node; int ret, target_is_dir, source_is_dir, source_is_link, fret, was_failure= 0; - int do_not_dive, target_is_split= 0; + int do_not_dive, target_is_split= 0, hide_attrs; struct DirseQ *dirseq= NULL; char *name, *img_name, *srcpt, *stbuf_src= ""; struct stat stbuf, hstbuf; @@ -313,12 +322,21 @@ cannot_open_dir:; {ret= -1; goto ex;} } - /* compare exclusions against disk_path resp. name */ + /* Compare exclusions against disk_path resp. name */ ret= Xorriso_path_is_excluded(xorriso, disk_path, 0); /* (is never param) */ if(ret<0) {ret= -1; goto ex;} if(ret>0) continue; + /* Check for mkisofs-style hidings */ + hide_attrs= (flag >> 8) & 3; + if(hide_attrs != 3) { + ret= Xorriso_path_is_hidden(xorriso, disk_path, 0); + if(ret<0) + return(ret); + if(ret>=0) + hide_attrs|= ret; + } strcpy(img_name, name); if(Xorriso_much_too_long(xorriso, strlen(img_path), 0)<=0) @@ -409,7 +427,7 @@ cannot_lstat:; if(node==NULL) { ret= Xorriso_tree_graft_node(xorriso, volume, dir, srcpt, img_name, "", img_path, (off_t) 0, (off_t) 0, - &node, 0); + &node, (hide_attrs << 8)); } if(node==NULL) { Xorriso_process_msg_queues(xorriso,0); @@ -470,11 +488,12 @@ ex: /* @param flag bit0= cut_out mode : base on leaf parent directory + bit1= do not check and perform hidings */ int Xorriso_copy_implicit_properties(struct XorrisO *xorriso, IsoDir *dir, char *full_img_path, char *img_path, char *full_disk_path, int flag) { - int ret, nfic, nic, nfdc, d, i; + int ret, nfic, nic, nfdc, d, i, hide_attrs; char nfi[SfileadrL], ni[SfileadrL], nfd[SfileadrL], *cpt; char sfe[5*SfileadrL]; struct stat stbuf; @@ -516,6 +535,20 @@ int Xorriso_copy_implicit_properties(struct XorrisO *xorriso, IsoDir *dir, " from %s", Text_shellsafe(nfd, sfe, 0)); if(!((flag&1) && d==0)) Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); + + if(!(flag & 2)) { + /* Check for mkisofs-style hidings */ + hide_attrs= 0; + ret= Xorriso_path_is_hidden(xorriso, nfd, 0); + if(ret<0) + return(ret); + if(ret>=0) { + /* Hide dir */ + ret= Xorriso_set_hidden(xorriso, (void *) dir, "", ret, 0); + if(ret <= 0) + return(ret); + } + } return(1); } @@ -558,6 +591,8 @@ int Xorriso_copy_properties(struct XorrisO *xorriso, bit5= if directory then do not add sub tree bit6= do not delete eventually existing node from di_array bit7= no special handling of split file directories + bit8= hide in iso_rr + bit9= hide in joliet @return <=0 = error , 1 = added simple node , 2 = added directory , 3 = rejected */ @@ -571,7 +606,7 @@ int Xorriso_graft_in(struct XorrisO *xorriso, void *boss_iter, IsoDir *dir, *hdir; IsoNode *node; int done= 0, is_dir= 0, l, ret, target_is_dir, source_is_dir, resolve_link= 0; - int target_is_split; + int target_is_split, hide_attrs; struct stat stbuf; ret= Xorriso_path_is_excluded(xorriso, disk_path, !(flag&4)); @@ -580,6 +615,16 @@ int Xorriso_graft_in(struct XorrisO *xorriso, void *boss_iter, if(ret>0) return(3*!!(flag&16)); + /* Check for mkisofs-style hidings */ + hide_attrs= (flag >> 8) & 3; + if(hide_attrs != 3) { + ret= Xorriso_path_is_hidden(xorriso, disk_path, 0); + if(ret<0) + return(ret); + if(ret>=0) + hide_attrs|= ret; + } + for(cpt= img_path; 1; cpt++) { cpt= strstr(cpt,"/."); if(cpt==NULL) @@ -731,9 +776,10 @@ handle_path_node:; iso_node_set_gid((IsoNode *) dir, getegid()); if(disk_path!=NULL && !done) + /* This not only copies disk directory properties + but also sets eventual hide_attrs */ Xorriso_copy_implicit_properties(xorriso, dir, img_path, path, disk_path, !!(flag&8)); - } if(done) { attach_source:; @@ -759,8 +805,8 @@ attach_source:; disk_path_pt= disk_path; ret= Xorriso_tree_graft_node(xorriso, volume, dir, disk_path_pt, apt, - disk_path, img_path, - offset, cut_size, &node, flag&8); + disk_path, img_path, offset, cut_size, + &node, (flag&8) | (hide_attrs << 8)); if(ret<=0) { sprintf(xorriso->info_text, "Grafting failed: %s = %s", Text_shellsafe(img_path,sfe,0), Text_shellsafe(disk_path,sfe2,0)); @@ -2649,14 +2695,11 @@ int Xorriso_perform_attr_from_list(struct XorrisO *xorriso, char *path, } value_lengths= calloc(num_attr, sizeof(size_t)); if(value_lengths== NULL) { - free(names); Xorriso_no_malloc_memory(xorriso, NULL, 0); ret= -1; goto ex; } values= calloc(num_attr, sizeof(char *)); if(values== NULL) { - free(names); - free(value_lengths); Xorriso_no_malloc_memory(xorriso, NULL, 0); ret= -1; goto ex; } diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index cbe8c6be..afdc3508 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2010.08.21.103003" +#define Xorriso_timestamP "2010.09.04.100823"