summaryrefslogtreecommitdiffstats
path: root/libtar/extract.c
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2017-02-03 21:26:15 +0100
committerEthan Yonker <dees_troy@teamw.in>2017-02-17 04:50:05 +0100
commit8d039f7bd84ce8cbbbe9ba5677f5a353d6224b66 (patch)
tree9cc3826e4e5e84f5ed7046eb7f804221bf0ab6f2 /libtar/extract.c
parentPartition: Remove unused has_data_media variable (diff)
downloadandroid_bootable_recovery-8d039f7bd84ce8cbbbe9ba5677f5a353d6224b66.tar
android_bootable_recovery-8d039f7bd84ce8cbbbe9ba5677f5a353d6224b66.tar.gz
android_bootable_recovery-8d039f7bd84ce8cbbbe9ba5677f5a353d6224b66.tar.bz2
android_bootable_recovery-8d039f7bd84ce8cbbbe9ba5677f5a353d6224b66.tar.lz
android_bootable_recovery-8d039f7bd84ce8cbbbe9ba5677f5a353d6224b66.tar.xz
android_bootable_recovery-8d039f7bd84ce8cbbbe9ba5677f5a353d6224b66.tar.zst
android_bootable_recovery-8d039f7bd84ce8cbbbe9ba5677f5a353d6224b66.zip
Diffstat (limited to 'libtar/extract.c')
-rw-r--r--libtar/extract.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/libtar/extract.c b/libtar/extract.c
index 87ccf245f..82ed766b2 100644
--- a/libtar/extract.c
+++ b/libtar/extract.c
@@ -37,6 +37,7 @@
#ifdef HAVE_EXT4_CRYPT
# include "ext4crypt_tar.h"
#endif
+#include "android_utils.h"
const unsigned long long progress_size = (unsigned long long)(T_BLOCKSIZE);
@@ -469,7 +470,6 @@ tar_extract_blockdev(TAR *t, const char *realname)
return 0;
}
-
/* directory */
int
tar_extract_dir(TAR *t, const char *realname)
@@ -521,6 +521,33 @@ tar_extract_dir(TAR *t, const char *realname)
}
}
+ if (t->options & TAR_STORE_ANDROID_USER_XATTR)
+ {
+ if (t->th_buf.has_user_default) {
+#if 1 //def DEBUG
+ printf("tar_extract_file(): restoring android user.default xattr to %s\n", realname);
+#endif
+ if (setxattr(realname, "user.default", NULL, 0, 0) < 0) {
+ fprintf(stderr, "tar_extract_file(): failed to restore android user.default to file %s !!!\n", realname);
+ return -1;
+ }
+ }
+ if (t->th_buf.has_user_cache) {
+#if 1 //def DEBUG
+ printf("tar_extract_file(): restoring android user.inode_cache xattr to %s\n", realname);
+#endif
+ if (write_path_inode(realname, "cache", "user.inode_cache"))
+ return -1;
+ }
+ if (t->th_buf.has_user_code_cache) {
+#if 1 //def DEBUG
+ printf("tar_extract_file(): restoring android user.inode_code_cache xattr to %s\n", realname);
+#endif
+ if (write_path_inode(realname, "code_cache", "user.inode_code_cache"))
+ return -1;
+ }
+ }
+
#ifdef HAVE_EXT4_CRYPT
if(t->th_buf.e4crypt_policy != NULL)
{