From a0782684fd5076fd2ad5ca4f611249da83182108 Mon Sep 17 00:00:00 2001 From: Matt Kraai Date: Mon, 15 Apr 2002 15:01:37 +0000 Subject: [PATCH] * archival/bunzip2.c (bunzip2_main): Do not remove files if writing to standard output. * testsuite/bunzip2/bzcat-does-not-remove-compressed-file: New. --- archival/bunzip2.c | 4 ++-- testsuite/bunzip2/bzcat-does-not-remove-compressed-file | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 testsuite/bunzip2/bzcat-does-not-remove-compressed-file diff --git a/archival/bunzip2.c b/archival/bunzip2.c index a7b41b7d1..f2d514912 100644 --- a/archival/bunzip2.c +++ b/archival/bunzip2.c @@ -2373,11 +2373,11 @@ int bunzip2_main(int argc, char **argv) } if (uncompressStream(src_stream, dst_stream)) { - if (save_name != NULL) + if (!(flags & bunzip_to_stdout)) delete_name = argv[optind]; status = EXIT_SUCCESS; } else { - if (save_name != NULL) + if (!(flags & bunzip_to_stdout)) delete_name = save_name; status = EXIT_FAILURE; } diff --git a/testsuite/bunzip2/bzcat-does-not-remove-compressed-file b/testsuite/bunzip2/bzcat-does-not-remove-compressed-file new file mode 100644 index 000000000..7d4016ec5 --- /dev/null +++ b/testsuite/bunzip2/bzcat-does-not-remove-compressed-file @@ -0,0 +1,3 @@ +echo foo | bzip2 >foo.bz2 +busybox bzcat foo.bz2 +test -f foo.bz2 -- 2.25.1