summaryrefslogtreecommitdiffstats
path: root/libtar
diff options
context:
space:
mode:
Diffstat (limited to 'libtar')
-rw-r--r--libtar/Android.mk14
-rw-r--r--libtar/append.c6
-rw-r--r--libtar/block.c10
-rw-r--r--libtar/extract.c6
-rw-r--r--libtar/libtar.h2
5 files changed, 9 insertions, 29 deletions
diff --git a/libtar/Android.mk b/libtar/Android.mk
index ddf8e058f..c8905d93f 100644
--- a/libtar/Android.mk
+++ b/libtar/Android.mk
@@ -10,11 +10,8 @@ LOCAL_C_INCLUDES += $(LOCAL_PATH) \
external/zlib
LOCAL_SHARED_LIBRARIES += libz libc
-ifeq ($(TWHAVE_SELINUX), true)
- LOCAL_C_INCLUDES += external/libselinux/include
- LOCAL_SHARED_LIBRARIES += libselinux
- LOCAL_CFLAGS += -DHAVE_SELINUX
-endif
+LOCAL_C_INCLUDES += external/libselinux/include
+LOCAL_SHARED_LIBRARIES += libselinux
ifeq ($(TW_INCLUDE_CRYPTO_FBE), true)
LOCAL_SHARED_LIBRARIES += libe4crypt
@@ -34,11 +31,8 @@ LOCAL_C_INCLUDES += $(LOCAL_PATH) \
external/zlib
LOCAL_STATIC_LIBRARIES += libz libc
-ifeq ($(TWHAVE_SELINUX), true)
- LOCAL_C_INCLUDES += external/libselinux/include
- LOCAL_STATIC_LIBRARIES += libselinux
- LOCAL_CFLAGS += -DHAVE_SELINUX
-endif
+LOCAL_C_INCLUDES += external/libselinux/include
+LOCAL_STATIC_LIBRARIES += libselinux
ifeq ($(TW_INCLUDE_CRYPTO_FBE), true)
LOCAL_SHARED_LIBRARIES += libe4crypt
diff --git a/libtar/append.c b/libtar/append.c
index 7c679f66d..d8ba3cad5 100644
--- a/libtar/append.c
+++ b/libtar/append.c
@@ -35,9 +35,7 @@
# include <unistd.h>
#endif
-#ifdef HAVE_SELINUX
-# include "selinux/selinux.h"
-#endif
+#include <selinux/selinux.h>
#ifdef HAVE_EXT4_CRYPT
# include "ext4crypt_tar.h"
@@ -105,7 +103,6 @@ tar_append_file(TAR *t, const char *realname, const char *savename)
#endif
th_set_path(t, (savename ? savename : realname));
-#ifdef HAVE_SELINUX
/* get selinux context */
if (t->options & TAR_STORE_SELINUX)
{
@@ -129,7 +126,6 @@ tar_append_file(TAR *t, const char *realname, const char *savename)
#endif
}
}
-#endif
#ifdef HAVE_EXT4_CRYPT
if (TH_ISDIR(t) && t->options & TAR_STORE_EXT4_POL)
diff --git a/libtar/block.c b/libtar/block.c
index a1178579b..1b3ba8242 100644
--- a/libtar/block.c
+++ b/libtar/block.c
@@ -123,10 +123,8 @@ th_read(TAR *t)
free(t->th_buf.gnu_longname);
if (t->th_buf.gnu_longlink != NULL)
free(t->th_buf.gnu_longlink);
-#ifdef HAVE_SELINUX
if (t->th_buf.selinux_context != NULL)
free(t->th_buf.selinux_context);
-#endif
#ifdef HAVE_EXT4_CRYPT
if (t->th_buf.e4crypt_policy != NULL) {
free(t->th_buf.e4crypt_policy);
@@ -287,7 +285,7 @@ th_read(TAR *t)
printf(" th_read(): Posix capabilities detected\n");
#endif
} // end posix capabilities
-#ifdef HAVE_SELINUX // selinux contexts
+ // selinux contexts
start = strstr(buf, SELINUX_TAG);
if(start && start+SELINUX_TAG_LEN < buf+len)
{
@@ -300,8 +298,7 @@ th_read(TAR *t)
printf(" th_read(): SELinux context xattr detected: %s\n", t->th_buf.selinux_context);
#endif
}
- }
-#endif // HAVE_SELINUX
+ } // end selinux contexts
#ifdef HAVE_EXT4_CRYPT
start = strstr(buf, E4CRYPT_TAG);
if(start && start+E4CRYPT_TAG_LEN < buf+len)
@@ -496,7 +493,7 @@ th_write(TAR *t)
memset(buf, 0, T_BLOCKSIZE);
ptr = buf;
-#ifdef HAVE_SELINUX
+
if((t->options & TAR_STORE_SELINUX) && t->th_buf.selinux_context != NULL)
{
#ifdef DEBUG
@@ -514,7 +511,6 @@ th_write(TAR *t)
snprintf(ptr, T_BLOCKSIZE, "%d "SELINUX_TAG"%s\n", (int)sz, t->th_buf.selinux_context);
ptr += sz;
}
-#endif
#ifdef HAVE_EXT4_CRYPT
if((t->options & TAR_STORE_EXT4_POL) && t->th_buf.e4crypt_policy != NULL)
diff --git a/libtar/extract.c b/libtar/extract.c
index 9e24e8ee7..87ccf245f 100644
--- a/libtar/extract.c
+++ b/libtar/extract.c
@@ -32,9 +32,7 @@
# include <unistd.h>
#endif
-#ifdef HAVE_SELINUX
-# include "selinux/selinux.h"
-#endif
+#include <selinux/selinux.h>
#ifdef HAVE_EXT4_CRYPT
# include "ext4crypt_tar.h"
@@ -159,7 +157,6 @@ tar_extract_file(TAR *t, const char *realname, const char *prefix, const int *pr
return i;
}
-#ifdef HAVE_SELINUX
if((t->options & TAR_STORE_SELINUX) && t->th_buf.selinux_context != NULL)
{
#ifdef DEBUG
@@ -168,7 +165,6 @@ tar_extract_file(TAR *t, const char *realname, const char *prefix, const int *pr
if (lsetfilecon(realname, t->th_buf.selinux_context) < 0)
fprintf(stderr, "tar_extract_file(): failed to restore SELinux context %s to file %s !!!\n", t->th_buf.selinux_context, realname);
}
-#endif
if((t->options & TAR_STORE_POSIX_CAP) && t->th_buf.has_cap_data)
{
diff --git a/libtar/libtar.h b/libtar/libtar.h
index 8c4202817..4d921247b 100644
--- a/libtar/libtar.h
+++ b/libtar/libtar.h
@@ -68,9 +68,7 @@ struct tar_header
char padding[12];
char *gnu_longname;
char *gnu_longlink;
-#ifdef HAVE_SELINUX
char *selinux_context;
-#endif
#ifdef HAVE_EXT4_CRYPT
char *e4crypt_policy;
#endif