summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--archival/tar.c4
-rw-r--r--testsuite/tar/tar-extracts-to-standard-output3
2 files changed, 6 insertions, 1 deletions
diff --git a/archival/tar.c b/archival/tar.c
index 00f9f87af..29244d4bf 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -645,7 +645,9 @@ int tar_main(int argc, char **argv)
break;
case 'x':
ctx_flag |= CTX_EXTRACT;
- tar_handle->action_data = data_extract_all;
+ if (tar_handle->action_data != data_extract_to_stdout) {
+ tar_handle->action_data = data_extract_all;
+ }
break;
/* These are optional */
diff --git a/testsuite/tar/tar-extracts-to-standard-output b/testsuite/tar/tar-extracts-to-standard-output
new file mode 100644
index 000000000..ca48e364e
--- /dev/null
+++ b/testsuite/tar/tar-extracts-to-standard-output
@@ -0,0 +1,3 @@
+echo foo > foo
+tar cf foo.tar foo
+cat foo.tar | busybox tar Ox | cmp foo -