Working towards coordination of -update and -cut_out
This commit is contained in:
@ -1358,10 +1358,23 @@ int Xorriso_get_node_by_path(struct XorrisO *xorriso,
|
||||
}
|
||||
|
||||
|
||||
/* @param flag bit0= give directory x-permission where is r-permission
|
||||
*/
|
||||
int Xorriso_transfer_properties(struct XorrisO *xorriso, struct stat *stbuf,
|
||||
IsoNode *node, int flag)
|
||||
{
|
||||
iso_node_set_permissions(node, stbuf->st_mode & 07777);
|
||||
mode_t mode;
|
||||
|
||||
mode= stbuf->st_mode;
|
||||
if((flag&1) && S_ISDIR(mode)) {
|
||||
if(mode&S_IRUSR)
|
||||
mode|= S_IXUSR;
|
||||
if(mode&S_IRGRP)
|
||||
mode|= S_IXGRP;
|
||||
if(mode&S_IROTH)
|
||||
mode|= S_IXOTH;
|
||||
}
|
||||
iso_node_set_permissions(node, mode & 07777);
|
||||
iso_node_set_uid(node, stbuf->st_uid);
|
||||
iso_node_set_gid(node, stbuf->st_gid);
|
||||
iso_node_set_atime(node, stbuf->st_atime);
|
||||
@ -1699,6 +1712,8 @@ int Xorriso_copy_implict_properties(struct XorrisO *xorriso, IsoDir *dir,
|
||||
strcpy(nfd, "/");
|
||||
if(stat(nfd, &stbuf)==-1)
|
||||
return(0);
|
||||
|
||||
#ifdef NIX
|
||||
if((flag&1) && d==0) {
|
||||
/* give directory x-permission where is r-permission */
|
||||
if(stbuf.st_mode&S_IRUSR)
|
||||
@ -1708,7 +1723,12 @@ int Xorriso_copy_implict_properties(struct XorrisO *xorriso, IsoDir *dir,
|
||||
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, flag&1);
|
||||
#else
|
||||
Xorriso_transfer_properties(xorriso, &stbuf, (IsoNode *) dir,
|
||||
((flag&1) && d==0));
|
||||
#endif /* ! NIX */
|
||||
|
||||
sprintf(xorriso->info_text,
|
||||
"Copied properties for %s", Text_shellsafe(ni, sfe, 0));
|
||||
sprintf(xorriso->info_text+strlen(xorriso->info_text),
|
||||
@ -1720,6 +1740,7 @@ int Xorriso_copy_implict_properties(struct XorrisO *xorriso, IsoDir *dir,
|
||||
|
||||
|
||||
/* @param bit0= copy link target properties rather than link properties
|
||||
bit1= give directory x-permission where is r-permission
|
||||
*/
|
||||
int Xorriso_copy_properties(struct XorrisO *xorriso,
|
||||
char *disk_path, char *img_path, int flag)
|
||||
@ -1733,7 +1754,7 @@ int Xorriso_copy_properties(struct XorrisO *xorriso,
|
||||
return(ret);
|
||||
if(lstat(disk_path, &stbuf)==-1)
|
||||
return(0);
|
||||
Xorriso_transfer_properties(xorriso, &stbuf, node, 0);
|
||||
Xorriso_transfer_properties(xorriso, &stbuf, node, (flag&2)>>1);
|
||||
xorriso->volset_change_pending= 1;
|
||||
return(1);
|
||||
}
|
||||
@ -4677,7 +4698,7 @@ int Xorriso_identify_split(struct XorrisO *xorriso, char *iso_adr,
|
||||
{
|
||||
int ret, i;
|
||||
int partno, total_parts, first_total_parts= -1;
|
||||
off_t offset, bytes, total_bytes, first_total_bytes= -1, size;
|
||||
off_t offset, bytes, total_bytes, first_total_bytes= -1, first_bytes, size;
|
||||
IsoImage *volume;
|
||||
IsoDir *dir_node;
|
||||
IsoDirIter *iter= NULL;
|
||||
@ -4713,25 +4734,26 @@ cannot_iter:;
|
||||
{ret= 0; goto ex;}
|
||||
if(i==0) {
|
||||
first_total_parts= total_parts;
|
||||
first_bytes= bytes;
|
||||
first_total_bytes= total_bytes;
|
||||
Xorriso_fake_stbuf(xorriso, "", &first_stbuf, &node, 1);
|
||||
size= first_stbuf.st_size;
|
||||
} else {
|
||||
if(first_total_parts!=total_parts || first_total_bytes!=total_bytes)
|
||||
if(first_total_parts!=total_parts || first_total_bytes!=total_bytes ||
|
||||
(first_bytes!=bytes && partno!=total_parts))
|
||||
{ret= 0; goto ex;}
|
||||
Xorriso_fake_stbuf(xorriso, "", &stbuf, &node, 1);
|
||||
if(first_stbuf.st_mode != stbuf.st_mode ||
|
||||
first_stbuf.st_uid != stbuf.st_uid ||
|
||||
first_stbuf.st_gid != stbuf.st_gid ||
|
||||
first_stbuf.st_mtime != stbuf.st_mtime ||
|
||||
first_stbuf.st_ctime != stbuf.st_ctime ||
|
||||
first_stbuf.st_atime != stbuf.st_atime)
|
||||
first_stbuf.st_ctime != stbuf.st_ctime)
|
||||
{ret= 0; goto ex;}
|
||||
size= stbuf.st_size;
|
||||
}
|
||||
/* check for plausible size */
|
||||
if(!((partno<total_parts && size==bytes) ||
|
||||
(partno==total_parts && size==(total_bytes-offset) && size<=bytes)))
|
||||
(partno==total_parts && size<=bytes)))
|
||||
{ret= 0; goto ex;}
|
||||
(*count)++;
|
||||
}
|
||||
|
Reference in New Issue
Block a user