Bug fix: Implicite directory attribute copying with -cut_out was wrong

This commit is contained in:
Thomas Schmitt 2008-03-22 13:05:25 +00:00
parent 07b54e308a
commit a44e7db9ea
2 changed files with 16 additions and 4 deletions

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.03.22.130031" #define Xorriso_timestamP "2008.03.22.130128"

View File

@ -1776,6 +1776,8 @@ ex:
} }
/* @param flag bit0= cut_out mode : base on leaf parent directory
*/
int Xorriso_copy_implict_properties(struct XorrisO *xorriso, IsoDir *dir, int Xorriso_copy_implict_properties(struct XorrisO *xorriso, IsoDir *dir,
char *full_img_path, char *img_path, char *full_disk_path, int flag) char *full_img_path, char *img_path, char *full_disk_path, int flag)
{ {
@ -1798,7 +1800,7 @@ int Xorriso_copy_implict_properties(struct XorrisO *xorriso, IsoDir *dir,
nfic= Sfile_count_components(nfi, 0); nfic= Sfile_count_components(nfi, 0);
nic= Sfile_count_components(ni, 0); nic= Sfile_count_components(ni, 0);
nfdc= Sfile_count_components(nfd, 0); nfdc= Sfile_count_components(nfd, 0);
d= nfic-nic; d= nfic-(flag&1)-nic;
if(d<0) if(d<0)
return(-1); return(-1);
if(d>nfdc) if(d>nfdc)
@ -1813,12 +1815,22 @@ int Xorriso_copy_implict_properties(struct XorrisO *xorriso, IsoDir *dir,
strcpy(nfd, "/"); strcpy(nfd, "/");
if(stat(nfd, &stbuf)==-1) if(stat(nfd, &stbuf)==-1)
return(0); return(0);
if((flag&1) && d==0) {
/* give directory x-permission where is r-permission */
if(stbuf.st_mode&S_IRUSR)
stbuf.st_mode|= S_IXUSR;
if(stbuf.st_mode&S_IRGRP)
stbuf.st_mode|= S_IXGRP;
if(stbuf.st_mode&S_IROTH)
stbuf.st_mode|= S_IXOTH;
}
Xorriso_transfer_properties(xorriso, &stbuf, (IsoNode *) dir, 0); Xorriso_transfer_properties(xorriso, &stbuf, (IsoNode *) dir, 0);
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"Copied properties for %s", Text_shellsafe(ni, sfe, 0)); "Copied properties for %s", Text_shellsafe(ni, sfe, 0));
sprintf(xorriso->info_text+strlen(xorriso->info_text), sprintf(xorriso->info_text+strlen(xorriso->info_text),
" from %s", Text_shellsafe(nfd, sfe, 0)); " from %s", Text_shellsafe(nfd, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); if((flag&1) && d==0)
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
return(1); return(1);
} }
@ -2024,7 +2036,7 @@ handle_path_node:;
if(disk_path!=NULL && !done) if(disk_path!=NULL && !done)
Xorriso_copy_implict_properties(xorriso, dir, img_path, path, disk_path, Xorriso_copy_implict_properties(xorriso, dir, img_path, path, disk_path,
0); !!(flag&8));
} }
if(done) { if(done) {