summaryrefslogtreecommitdiffstats
path: root/libtar
diff options
context:
space:
mode:
authorbigbiff bigbiff <bigbiff@teamw.in>2013-10-12 02:28:00 +0200
committerDees Troy <dees_troy@teamw.in>2013-10-23 21:27:48 +0200
commitd0c24c50d9857254f5d32cf53adb0091ceaa1fa6 (patch)
tree891df97429b1c72eeba6f7b2ac4c26a997ab88b4 /libtar
parentMerge "Remove trailing spaces on auto generated backup names" into android-4.3 (diff)
downloadandroid_bootable_recovery-d0c24c50d9857254f5d32cf53adb0091ceaa1fa6.tar
android_bootable_recovery-d0c24c50d9857254f5d32cf53adb0091ceaa1fa6.tar.gz
android_bootable_recovery-d0c24c50d9857254f5d32cf53adb0091ceaa1fa6.tar.bz2
android_bootable_recovery-d0c24c50d9857254f5d32cf53adb0091ceaa1fa6.tar.lz
android_bootable_recovery-d0c24c50d9857254f5d32cf53adb0091ceaa1fa6.tar.xz
android_bootable_recovery-d0c24c50d9857254f5d32cf53adb0091ceaa1fa6.tar.zst
android_bootable_recovery-d0c24c50d9857254f5d32cf53adb0091ceaa1fa6.zip
Diffstat (limited to 'libtar')
-rw-r--r--libtar/append.c15
-rw-r--r--libtar/extract.c3
2 files changed, 6 insertions, 12 deletions
diff --git a/libtar/append.c b/libtar/append.c
index 3a8bfc690..dcd864984 100644
--- a/libtar/append.c
+++ b/libtar/append.c
@@ -92,29 +92,22 @@ tar_append_file(TAR *t, char *realname, char *savename)
#ifdef HAVE_SELINUX
/* get selinux context */
- if(t->options & TAR_STORE_SELINUX)
- {
- if(t->th_buf.selinux_context != NULL)
- {
+ if(t->options & TAR_STORE_SELINUX) {
+ if(t->th_buf.selinux_context != NULL) {
free(t->th_buf.selinux_context);
t->th_buf.selinux_context = NULL;
}
security_context_t selinux_context = NULL;
- if(getfilecon(realname, &selinux_context) >= 0)
- {
+ if (lgetfilecon(realname, &selinux_context) >= 0) {
t->th_buf.selinux_context = strdup(selinux_context);
+ printf("setting selinux context: %s\n", selinux_context);
freecon(selinux_context);
}
else
- {
-#ifdef DEBUG
perror("Failed to get selinux context");
-#endif
- }
}
#endif
-
/* check if it's a hardlink */
#ifdef DEBUG
puts(" tar_append_file(): checking inode cache for hardlink...");
diff --git a/libtar/extract.c b/libtar/extract.c
index d19ba859d..8081aa2b9 100644
--- a/libtar/extract.c
+++ b/libtar/extract.c
@@ -161,8 +161,9 @@ tar_extract_file(TAR *t, char *realname, char *prefix)
#ifdef DEBUG
printf(" Restoring SELinux context %s to file %s\n", t->th_buf.selinux_context, realname);
#endif
- if(setfilecon(realname, t->th_buf.selinux_context) < 0)
+ if (lsetfilecon(realname, t->th_buf.selinux_context) < 0) {
fprintf(stderr, "Failed to restore SELinux context %s!\n", strerror(errno));
+ }
}
#endif