zcat: complain if input is not compressed

function                                             old     new   delta
buffer_fill_and_print                                178     191     +13
varvalue                                             735     743      +8
bbunpack                                             747     755      +8
open_zipped                                           85      89      +4
xmalloc_open_zipped_read_close                        61      63      +2
get_addr_1                                           240     242      +2
fbsplash_main                                       1228    1230      +2
pstree_main                                          322     321      -1
builtin_type                                         121     119      -2
do_load                                              954     926     -28
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 7/3 up/down: 39/-31)              Total: 8 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/archival/libarchive/get_header_tar.c b/archival/libarchive/get_header_tar.c
index 54d9104..ba43bb0 100644
--- a/archival/libarchive/get_header_tar.c
+++ b/archival/libarchive/get_header_tar.c
@@ -243,7 +243,7 @@
 		 * or not first block (false positive, it's not .gz/.bz2!) */
 		if (lseek(archive_handle->src_fd, -i, SEEK_CUR) != 0)
 			goto err;
-		if (setup_unzip_on_fd(archive_handle->src_fd, /*fail_if_not_detected:*/ 0) != 0)
+		if (setup_unzip_on_fd(archive_handle->src_fd, /*fail_if_not_compressed:*/ 0) != 0)
  err:
 			bb_error_msg_and_die("invalid tar magic");
 		archive_handle->offset = 0;
diff --git a/archival/libarchive/open_transformer.c b/archival/libarchive/open_transformer.c
index 27854af..1986630 100644
--- a/archival/libarchive/open_transformer.c
+++ b/archival/libarchive/open_transformer.c
@@ -118,7 +118,7 @@
 /* Used by e.g. rpm which gives us a fd without filename,
  * thus we can't guess the format from filename's extension.
  */
-int FAST_FUNC setup_unzip_on_fd(int fd, int fail_if_not_detected)
+int FAST_FUNC setup_unzip_on_fd(int fd, int fail_if_not_compressed)
 {
 	union {
 		uint8_t b[4];
@@ -159,7 +159,7 @@
 	}
 
 	/* No known magic seen */
-	if (fail_if_not_detected)
+	if (fail_if_not_compressed)
 		bb_error_msg_and_die("no gzip"
 			IF_FEATURE_SEAMLESS_BZ2("/bzip2")
 			IF_FEATURE_SEAMLESS_XZ("/xz")
@@ -180,7 +180,7 @@
 	return 0;
 }
 
-int FAST_FUNC open_zipped(const char *fname)
+int FAST_FUNC open_zipped(const char *fname, int fail_if_not_compressed)
 {
 	int fd;
 
@@ -200,16 +200,7 @@
 	 || (ENABLE_FEATURE_SEAMLESS_BZ2)
 	 || (ENABLE_FEATURE_SEAMLESS_XZ)
 	) {
-		/*
-		 * Do we want to fail_if_not_detected?
-		 * In most cases, no: think "insmod non_compressed_module".
-		 * A case which would like to fail is "zcat uncompressed_file":
-		 * otherwise, it happily outputs uncompressed_file as-is,
-		 * which is, strictly speaking, not what is expected.
-		 * If this ever becomes a problem, we can add
-		 * fail_if_not_detected bool argument to open_zipped().
-		 */
-		setup_unzip_on_fd(fd, /*fail_if_not_detected:*/ 0);
+		setup_unzip_on_fd(fd, fail_if_not_compressed);
 	}
 
 	return fd;
@@ -222,7 +213,7 @@
 	int fd;
 	char *image;
 
-	fd = open_zipped(fname);
+	fd = open_zipped(fname, /*fail_if_not_compressed:*/ 0);
 	if (fd < 0)
 		return NULL;