aboutsummaryrefslogtreecommitdiff
path: root/archival/tar.c
diff options
context:
space:
mode:
Diffstat (limited to 'archival/tar.c')
-rw-r--r--archival/tar.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/archival/tar.c b/archival/tar.c
index 150c6f393..74d6fca91 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -657,7 +657,7 @@ static llist_t *append_file_list_to_list(llist_t *list)
657 llist_t *newlist = NULL; 657 llist_t *newlist = NULL;
658 658
659 while (list) { 659 while (list) {
660 src_stream = xfopen_for_read(llist_pop(&list)); 660 src_stream = xfopen_stdin(llist_pop(&list));
661 while ((line = xmalloc_fgetline(src_stream)) != NULL) { 661 while ((line = xmalloc_fgetline(src_stream)) != NULL) {
662 /* kill trailing '/' unless the string is just "/" */ 662 /* kill trailing '/' unless the string is just "/" */
663 char *cp = last_char_is(line, '/'); 663 char *cp = last_char_is(line, '/');
@@ -722,11 +722,16 @@ static void handle_SIGCHLD(int status)
722#endif 722#endif
723 723
724//usage:#define tar_trivial_usage 724//usage:#define tar_trivial_usage
725//usage: "-[" IF_FEATURE_TAR_CREATE("c") "xt" IF_FEATURE_SEAMLESS_GZ("z") 725//usage: "-[" IF_FEATURE_TAR_CREATE("c") "xt"
726//usage: IF_FEATURE_SEAMLESS_BZ2("j") IF_FEATURE_SEAMLESS_LZMA("a") 726//usage: IF_FEATURE_SEAMLESS_Z("Z")
727//usage: IF_FEATURE_SEAMLESS_Z("Z") IF_FEATURE_TAR_NOPRESERVE_TIME("m") "vO] " 727//usage: IF_FEATURE_SEAMLESS_GZ("z")
728//usage: IF_FEATURE_TAR_FROM("[-X FILE] ") 728//usage: IF_FEATURE_SEAMLESS_BZ2("j")
729//usage: "[-f TARFILE] [-C DIR] [FILE]..." 729//usage: IF_FEATURE_SEAMLESS_LZMA("a")
730//usage: IF_FEATURE_TAR_CREATE("h")
731//usage: IF_FEATURE_TAR_NOPRESERVE_TIME("m")
732//usage: "vO] "
733//usage: IF_FEATURE_TAR_FROM("[-X FILE] [-T FILE] ")
734//usage: "[-f TARFILE] [-C DIR] [FILE]..."
730//usage:#define tar_full_usage "\n\n" 735//usage:#define tar_full_usage "\n\n"
731//usage: IF_FEATURE_TAR_CREATE("Create, extract, ") 736//usage: IF_FEATURE_TAR_CREATE("Create, extract, ")
732//usage: IF_NOT_FEATURE_TAR_CREATE("Extract ") 737//usage: IF_NOT_FEATURE_TAR_CREATE("Extract ")
@@ -741,6 +746,9 @@ static void handle_SIGCHLD(int status)
741//usage: "\n f Name of TARFILE ('-' for stdin/out)" 746//usage: "\n f Name of TARFILE ('-' for stdin/out)"
742//usage: "\n C Change to DIR before operation" 747//usage: "\n C Change to DIR before operation"
743//usage: "\n v Verbose" 748//usage: "\n v Verbose"
749//usage: IF_FEATURE_SEAMLESS_Z(
750//usage: "\n Z (De)compress using compress"
751//usage: )
744//usage: IF_FEATURE_SEAMLESS_GZ( 752//usage: IF_FEATURE_SEAMLESS_GZ(
745//usage: "\n z (De)compress using gzip" 753//usage: "\n z (De)compress using gzip"
746//usage: ) 754//usage: )
@@ -750,9 +758,6 @@ static void handle_SIGCHLD(int status)
750//usage: IF_FEATURE_SEAMLESS_LZMA( 758//usage: IF_FEATURE_SEAMLESS_LZMA(
751//usage: "\n a (De)compress using lzma" 759//usage: "\n a (De)compress using lzma"
752//usage: ) 760//usage: )
753//usage: IF_FEATURE_SEAMLESS_Z(
754//usage: "\n Z (De)compress using compress"
755//usage: )
756//usage: "\n O Extract to stdout" 761//usage: "\n O Extract to stdout"
757//usage: IF_FEATURE_TAR_CREATE( 762//usage: IF_FEATURE_TAR_CREATE(
758//usage: "\n h Follow symlinks" 763//usage: "\n h Follow symlinks"
@@ -1057,8 +1062,10 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
1057 tar_handle->src_fd = tar_fd; 1062 tar_handle->src_fd = tar_fd;
1058 tar_handle->seek = seek_by_read; 1063 tar_handle->seek = seek_by_read;
1059 } else { 1064 } else {
1060 if (ENABLE_FEATURE_TAR_AUTODETECT && flags == O_RDONLY) { 1065 if (ENABLE_FEATURE_TAR_AUTODETECT
1061 get_header_ptr = get_header_tar; 1066 && flags == O_RDONLY
1067 && get_header_ptr == get_header_tar
1068 ) {
1062 tar_handle->src_fd = open_zipped(tar_filename); 1069 tar_handle->src_fd = open_zipped(tar_filename);
1063 if (tar_handle->src_fd < 0) 1070 if (tar_handle->src_fd < 0)
1064 bb_perror_msg_and_die("can't open '%s'", tar_filename); 1071 bb_perror_msg_and_die("can't open '%s'", tar_filename);