diff options
author | kraai <kraai@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2002-04-15 15:01:37 +0000 |
---|---|---|
committer | kraai <kraai@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2002-04-15 15:01:37 +0000 |
commit | d47dc4aea0843342cff21cb62a26b69ac37f4c2a (patch) | |
tree | 531b3fd32169ab5a0393d0629e9882d964383922 | |
parent | 7b0d2db12f94eb074765715c7096c33876d120af (diff) | |
download | busybox-w32-d47dc4aea0843342cff21cb62a26b69ac37f4c2a.tar.gz busybox-w32-d47dc4aea0843342cff21cb62a26b69ac37f4c2a.tar.bz2 busybox-w32-d47dc4aea0843342cff21cb62a26b69ac37f4c2a.zip |
* archival/bunzip2.c (bunzip2_main): Do not remove files if writing to standard
output.
* testsuite/bunzip2/bzcat-does-not-remove-compressed-file: New.
git-svn-id: svn://busybox.net/trunk/busybox@4628 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r-- | archival/bunzip2.c | 4 | ||||
-rw-r--r-- | testsuite/bunzip2/bzcat-does-not-remove-compressed-file | 3 |
2 files changed, 5 insertions, 2 deletions
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) | |||
2373 | } | 2373 | } |
2374 | 2374 | ||
2375 | if (uncompressStream(src_stream, dst_stream)) { | 2375 | if (uncompressStream(src_stream, dst_stream)) { |
2376 | if (save_name != NULL) | 2376 | if (!(flags & bunzip_to_stdout)) |
2377 | delete_name = argv[optind]; | 2377 | delete_name = argv[optind]; |
2378 | status = EXIT_SUCCESS; | 2378 | status = EXIT_SUCCESS; |
2379 | } else { | 2379 | } else { |
2380 | if (save_name != NULL) | 2380 | if (!(flags & bunzip_to_stdout)) |
2381 | delete_name = save_name; | 2381 | delete_name = save_name; |
2382 | status = EXIT_FAILURE; | 2382 | status = EXIT_FAILURE; |
2383 | } | 2383 | } |
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 @@ | |||
1 | echo foo | bzip2 >foo.bz2 | ||
2 | busybox bzcat foo.bz2 | ||
3 | test -f foo.bz2 | ||