diff options
Diffstat (limited to 'archival')
-rw-r--r-- | archival/libarchive/get_header_tar.c | 23 | ||||
-rw-r--r-- | archival/tar.c | 6 |
2 files changed, 20 insertions, 9 deletions
diff --git a/archival/libarchive/get_header_tar.c b/archival/libarchive/get_header_tar.c index ac2be726f..ea91a883e 100644 --- a/archival/libarchive/get_header_tar.c +++ b/archival/libarchive/get_header_tar.c | |||
@@ -60,13 +60,21 @@ static unsigned long long getOctal(char *str, int len) | |||
60 | } | 60 | } |
61 | #define GET_OCTAL(a) getOctal((a), sizeof(a)) | 61 | #define GET_OCTAL(a) getOctal((a), sizeof(a)) |
62 | 62 | ||
63 | #define TAR_EXTD (ENABLE_FEATURE_TAR_GNU_EXTENSIONS || ENABLE_FEATURE_TAR_SELINUX) | ||
64 | #if !TAR_EXTD | ||
65 | #define process_pax_hdr(archive_handle, sz, global) \ | ||
66 | process_pax_hdr(archive_handle, sz) | ||
67 | #endif | ||
63 | /* "global" is 0 or 1 */ | 68 | /* "global" is 0 or 1 */ |
64 | static void process_pax_hdr(archive_handle_t *archive_handle, unsigned sz, int global) | 69 | static void process_pax_hdr(archive_handle_t *archive_handle, unsigned sz, int global) |
65 | { | 70 | { |
71 | #if !TAR_EXTD | ||
72 | unsigned blk_sz = (sz + 511) & (~511); | ||
73 | seek_by_read(archive_handle->src_fd, blk_sz); | ||
74 | #else | ||
75 | unsigned blk_sz = (sz + 511) & (~511); | ||
66 | char *buf, *p; | 76 | char *buf, *p; |
67 | unsigned blk_sz; | ||
68 | 77 | ||
69 | blk_sz = (sz + 511) & (~511); | ||
70 | p = buf = xmalloc(blk_sz + 1); | 78 | p = buf = xmalloc(blk_sz + 1); |
71 | xread(archive_handle->src_fd, buf, blk_sz); | 79 | xread(archive_handle->src_fd, buf, blk_sz); |
72 | archive_handle->offset += blk_sz; | 80 | archive_handle->offset += blk_sz; |
@@ -104,30 +112,31 @@ static void process_pax_hdr(archive_handle_t *archive_handle, unsigned sz, int g | |||
104 | p[-1] = '\0'; | 112 | p[-1] = '\0'; |
105 | value = end + 1; | 113 | value = end + 1; |
106 | 114 | ||
107 | #if ENABLE_FEATURE_TAR_GNU_EXTENSIONS | 115 | # if ENABLE_FEATURE_TAR_GNU_EXTENSIONS |
108 | if (!global && is_prefixed_with(value, "path=")) { | 116 | if (!global && is_prefixed_with(value, "path=")) { |
109 | value += sizeof("path=") - 1; | 117 | value += sizeof("path=") - 1; |
110 | free(archive_handle->tar__longname); | 118 | free(archive_handle->tar__longname); |
111 | archive_handle->tar__longname = xstrdup(value); | 119 | archive_handle->tar__longname = xstrdup(value); |
112 | continue; | 120 | continue; |
113 | } | 121 | } |
114 | #endif | 122 | # endif |
115 | 123 | ||
116 | #if ENABLE_FEATURE_TAR_SELINUX | 124 | # if ENABLE_FEATURE_TAR_SELINUX |
117 | /* Scan for SELinux contexts, via "RHT.security.selinux" keyword. | 125 | /* Scan for SELinux contexts, via "RHT.security.selinux" keyword. |
118 | * This is what Red Hat's patched version of tar uses. | 126 | * This is what Red Hat's patched version of tar uses. |
119 | */ | 127 | */ |
120 | # define SELINUX_CONTEXT_KEYWORD "RHT.security.selinux" | 128 | # define SELINUX_CONTEXT_KEYWORD "RHT.security.selinux" |
121 | if (is_prefixed_with(value, SELINUX_CONTEXT_KEYWORD"=")) { | 129 | if (is_prefixed_with(value, SELINUX_CONTEXT_KEYWORD"=")) { |
122 | value += sizeof(SELINUX_CONTEXT_KEYWORD"=") - 1; | 130 | value += sizeof(SELINUX_CONTEXT_KEYWORD"=") - 1; |
123 | free(archive_handle->tar__sctx[global]); | 131 | free(archive_handle->tar__sctx[global]); |
124 | archive_handle->tar__sctx[global] = xstrdup(value); | 132 | archive_handle->tar__sctx[global] = xstrdup(value); |
125 | continue; | 133 | continue; |
126 | } | 134 | } |
127 | #endif | 135 | # endif |
128 | } | 136 | } |
129 | 137 | ||
130 | free(buf); | 138 | free(buf); |
139 | #endif | ||
131 | } | 140 | } |
132 | 141 | ||
133 | char FAST_FUNC get_header_tar(archive_handle_t *archive_handle) | 142 | char FAST_FUNC get_header_tar(archive_handle_t *archive_handle) |
diff --git a/archival/tar.c b/archival/tar.c index 346a9404e..7434e22e4 100644 --- a/archival/tar.c +++ b/archival/tar.c | |||
@@ -1199,9 +1199,10 @@ int tar_main(int argc UNUSED_PARAM, char **argv) | |||
1199 | // /* We need to know whether child (gzip/bzip/etc) exits abnormally */ | 1199 | // /* We need to know whether child (gzip/bzip/etc) exits abnormally */ |
1200 | // signal(SIGCHLD, check_errors_in_children); | 1200 | // signal(SIGCHLD, check_errors_in_children); |
1201 | 1201 | ||
1202 | #if ENABLE_FEATURE_TAR_CREATE | ||
1202 | /* Create an archive */ | 1203 | /* Create an archive */ |
1203 | if (opt & OPT_CREATE) { | 1204 | if (opt & OPT_CREATE) { |
1204 | #if SEAMLESS_COMPRESSION | 1205 | # if SEAMLESS_COMPRESSION |
1205 | const char *zipMode = NULL; | 1206 | const char *zipMode = NULL; |
1206 | if (opt & OPT_COMPRESS) | 1207 | if (opt & OPT_COMPRESS) |
1207 | zipMode = "compress"; | 1208 | zipMode = "compress"; |
@@ -1213,7 +1214,7 @@ int tar_main(int argc UNUSED_PARAM, char **argv) | |||
1213 | zipMode = "lzma"; | 1214 | zipMode = "lzma"; |
1214 | if (opt & OPT_XZ) | 1215 | if (opt & OPT_XZ) |
1215 | zipMode = "xz"; | 1216 | zipMode = "xz"; |
1216 | #endif | 1217 | # endif |
1217 | /* NB: writeTarFile() closes tar_handle->src_fd */ | 1218 | /* NB: writeTarFile() closes tar_handle->src_fd */ |
1218 | return writeTarFile(tar_handle->src_fd, verboseFlag, | 1219 | return writeTarFile(tar_handle->src_fd, verboseFlag, |
1219 | (opt & OPT_DEREFERENCE ? ACTION_FOLLOWLINKS : 0) | 1220 | (opt & OPT_DEREFERENCE ? ACTION_FOLLOWLINKS : 0) |
@@ -1221,6 +1222,7 @@ int tar_main(int argc UNUSED_PARAM, char **argv) | |||
1221 | tar_handle->accept, | 1222 | tar_handle->accept, |
1222 | tar_handle->reject, zipMode); | 1223 | tar_handle->reject, zipMode); |
1223 | } | 1224 | } |
1225 | #endif | ||
1224 | 1226 | ||
1225 | if (opt & OPT_ANY_COMPRESS) { | 1227 | if (opt & OPT_ANY_COMPRESS) { |
1226 | USE_FOR_MMU(IF_DESKTOP(long long) int FAST_FUNC (*xformer)(transformer_state_t *xstate);) | 1228 | USE_FOR_MMU(IF_DESKTOP(long long) int FAST_FUNC (*xformer)(transformer_state_t *xstate);) |