Enabled restoring of xattr

This commit is contained in:
2009-02-02 20:11:26 +00:00
parent 85d9cc709d
commit 58c0732a8e
3 changed files with 66 additions and 8 deletions

View File

@ -2009,7 +2009,7 @@ int Xorriso_transfer_properties(struct XorrisO *xorriso, struct stat *stbuf,
if(xorriso->do_aaip & 5) {
ret= iso_local_get_attrs(disk_path, &num_attrs, &names, &value_lengths,
&values, ((xorriso->do_aaip & 1) && !(flag & 2))
| (!(xorriso->do_aaip & 4)) << 4);
| (!(xorriso->do_aaip & 4)) << 2);
if(ret < 0) {
Xorriso_process_msg_queues(xorriso,0);
Xorriso_report_iso_error(xorriso, disk_path, ret,
@ -2862,9 +2862,16 @@ int Xorriso_restore_properties(struct XorrisO *xorriso, char *disk_path,
uid_t uid;
gid_t gid;
struct utimbuf utime_buffer;
char sfe[5*SfileadrL], *access_text= NULL, *default_text= NULL;
char sfe[5*SfileadrL];
struct stat stbuf;
#ifdef NIX
char *access_text= NULL, *default_text= NULL;
#else
size_t num_attrs= 0, *value_lengths= NULL;
char **names= NULL, **values= NULL;
#endif
ret= lstat(disk_path, &stbuf);
if(ret==-1) {
sprintf(xorriso->info_text,
@ -2902,10 +2909,9 @@ int Xorriso_restore_properties(struct XorrisO *xorriso, char *disk_path,
#ifdef Xorriso_with_aaiP
#ifdef NIX
if(xorriso->do_aaip & 2) {
/* >>> change to iso_node_get_attrs */;
ret= iso_node_get_acl_text(node, &access_text, &default_text, 16);
if(ret < 0) {
strcpy(xorriso->info_text, "Error with obtaining ACL for ");
@ -2934,6 +2940,33 @@ cannot_change_acl:;
}
}
#else /* NIX */
if(xorriso->do_aaip & 10) {
ret= iso_node_get_attrs(node, &num_attrs, &names, &value_lengths, &values,
(!!(xorriso->do_aaip & 2)) | (!(xorriso->do_aaip & 8)) << 2);
if (ret < 0) {
strcpy(xorriso->info_text, "Error with obtaining ACL and xattr for ");
Text_shellsafe(disk_path, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
{ret= 0; goto ex;}
}
if(num_attrs > 0) {
ret= iso_local_set_attrs(disk_path, num_attrs, names, value_lengths,
values, 0);
if(ret < 0) {
sprintf(xorriso->info_text,
"Cannot change ACL or xattr of disk file %s",
Text_shellsafe(disk_path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE",0);
{ret= 0; goto ex;}
}
}
Xorriso_process_msg_queues(xorriso,0);
}
#endif /* ! NIX */
#endif /* Xorriso_with_aaiP */
if(flag&1)
@ -2955,7 +2988,11 @@ cannot_change_acl:;
}
ret= 1;
ex:;
#ifdef NIX
iso_node_get_acl_text(node, &access_text, &default_text, 1 << 15);
#else
iso_node_get_attrs(node, &num_attrs, &names, &value_lengths, &values,1 << 15);
#endif
return(ret);
}