diff options
Diffstat (limited to 'contrib/libarchive/unzip')
| -rw-r--r-- | contrib/libarchive/unzip/bsdunzip.c | 15 | ||||
| -rw-r--r-- | contrib/libarchive/unzip/cmdline.c | 2 | ||||
| -rw-r--r-- | contrib/libarchive/unzip/test/test_C.c | 4 | ||||
| -rw-r--r-- | contrib/libarchive/unzip/test/test_L.c | 4 | ||||
| -rw-r--r-- | contrib/libarchive/unzip/test/test_P_encryption.c | 12 | ||||
| -rw-r--r-- | contrib/libarchive/unzip/test/test_basic.c | 4 | ||||
| -rw-r--r-- | contrib/libarchive/unzip/test/test_d.c | 8 | ||||
| -rw-r--r-- | contrib/libarchive/unzip/test/test_doubledash.c | 4 | ||||
| -rw-r--r-- | contrib/libarchive/unzip/test/test_glob.c | 4 | ||||
| -rw-r--r-- | contrib/libarchive/unzip/test/test_j.c | 4 | ||||
| -rw-r--r-- | contrib/libarchive/unzip/test/test_n.c | 4 | ||||
| -rw-r--r-- | contrib/libarchive/unzip/test/test_o.c | 4 | ||||
| -rw-r--r-- | contrib/libarchive/unzip/test/test_p.c | 4 | ||||
| -rw-r--r-- | contrib/libarchive/unzip/test/test_q.c | 4 | ||||
| -rw-r--r-- | contrib/libarchive/unzip/test/test_singlefile.c | 4 | ||||
| -rw-r--r-- | contrib/libarchive/unzip/test/test_t.c | 4 | ||||
| -rw-r--r-- | contrib/libarchive/unzip/test/test_x.c | 12 | 
17 files changed, 91 insertions, 6 deletions
| diff --git a/contrib/libarchive/unzip/bsdunzip.c b/contrib/libarchive/unzip/bsdunzip.c index 621afbeb9d6a..1b520e841690 100644 --- a/contrib/libarchive/unzip/bsdunzip.c +++ b/contrib/libarchive/unzip/bsdunzip.c @@ -29,6 +29,9 @@  #ifdef HAVE_LOCALE_H  #include <locale.h>  #endif +#ifdef HAVE_SIGNAL_H +#include <signal.h> +#endif  #ifdef HAVE_STDARG_H  #include <stdarg.h>  #endif @@ -54,7 +57,7 @@  #include "bsdunzip.h"  #include "passphrase.h" -#include "err.h" +#include "lafe_err.h"  /* command-line options */  static int		 a_opt;		/* convert EOL */ @@ -1187,6 +1190,16 @@ main(int argc, char *argv[])  	const char *zipfile;  	int nopts; +#if defined(HAVE_SIGACTION) && defined(SIGCHLD) +	{ /* Do not ignore SIGCHLD. */ +		struct sigaction sa; +		sa.sa_handler = SIG_DFL; +		sigemptyset(&sa.sa_mask); +		sa.sa_flags = 0; +		sigaction(SIGCHLD, &sa, NULL); +	} +#endif +  	lafe_setprogname(*argv, "bsdunzip");  #if HAVE_SETLOCALE diff --git a/contrib/libarchive/unzip/cmdline.c b/contrib/libarchive/unzip/cmdline.c index 8afddedd5ead..8e6eedd2321c 100644 --- a/contrib/libarchive/unzip/cmdline.c +++ b/contrib/libarchive/unzip/cmdline.c @@ -21,7 +21,7 @@  #endif  #include "bsdunzip.h" -#include "err.h" +#include "lafe_err.h"  /*   * Short options for bsdunzip.  Please keep this sorted. diff --git a/contrib/libarchive/unzip/test/test_C.c b/contrib/libarchive/unzip/test/test_C.c index 66835c8406f3..d386bd61e85d 100644 --- a/contrib/libarchive/unzip/test/test_C.c +++ b/contrib/libarchive/unzip/test/test_C.c @@ -9,6 +9,7 @@  /* Test C arg - match case-insensitive */  DEFINE_TEST(test_C)  { +#ifdef HAVE_LIBZ  	const char *reffile = "test_basic.zip";  	int r; @@ -19,4 +20,7 @@ DEFINE_TEST(test_C)  	assertEmptyFile("test.err");  	assertTextFileContents("contents CAPS\n", "test_basic/CAPS"); +#else +	skipping("zlib not available"); +#endif  } diff --git a/contrib/libarchive/unzip/test/test_L.c b/contrib/libarchive/unzip/test/test_L.c index 5b004d5d5707..85b43f592542 100644 --- a/contrib/libarchive/unzip/test/test_L.c +++ b/contrib/libarchive/unzip/test/test_L.c @@ -9,6 +9,7 @@  /* Test L arg - make names lowercase */  DEFINE_TEST(test_L)  { +#ifdef HAVE_LIBZ  	const char *reffile = "test_basic.zip";  	int r; @@ -22,4 +23,7 @@ DEFINE_TEST(test_L)  	assertTextFileContents("contents b\n", "test_basic/b");  	assertTextFileContents("contents c\n", "test_basic/c");  	assertTextFileContents("contents CAPS\n", "test_basic/caps"); +#else +	skipping("zlib not available"); +#endif  } diff --git a/contrib/libarchive/unzip/test/test_P_encryption.c b/contrib/libarchive/unzip/test/test_P_encryption.c index e2cf3cda0ebd..ed08a068811b 100644 --- a/contrib/libarchive/unzip/test/test_P_encryption.c +++ b/contrib/libarchive/unzip/test/test_P_encryption.c @@ -14,9 +14,13 @@ DEFINE_TEST(test_P_encryption)  	extract_reference_file(reffile);  	r = systemf("%s -P password %s >test.out 2>test.err", testprog, reffile); -	assertEqualInt(0, r); -	assertNonEmptyFile("test.out"); -	assertEmptyFile("test.err"); +	if (r == 256) { +		assertTextFileContents("unzip: Decryption is unsupported due to lack of crypto library\n", "test.err"); +	} else { +		assertEqualInt(0, r); +		assertNonEmptyFile("test.out"); +		assertEmptyFile("test.err"); -	assertTextFileContents("plaintext\n", "encrypted/file.txt"); +		assertTextFileContents("plaintext\n", "encrypted/file.txt"); +	}  } diff --git a/contrib/libarchive/unzip/test/test_basic.c b/contrib/libarchive/unzip/test/test_basic.c index 1f37dcd416a3..3a884aa30e5d 100644 --- a/contrib/libarchive/unzip/test/test_basic.c +++ b/contrib/libarchive/unzip/test/test_basic.c @@ -9,6 +9,7 @@  /* This test just does a basic zip decompression */  DEFINE_TEST(test_basic)  { +#ifdef HAVE_LIBZ  	const char *reffile = "test_basic.zip";  	int r; @@ -22,4 +23,7 @@ DEFINE_TEST(test_basic)  	assertTextFileContents("contents b\n", "test_basic/b");  	assertTextFileContents("contents c\n", "test_basic/c");  	assertTextFileContents("contents CAPS\n", "test_basic/CAPS"); +#else +	skipping("zlib not available"); +#endif  } diff --git a/contrib/libarchive/unzip/test/test_d.c b/contrib/libarchive/unzip/test/test_d.c index ea67246207f2..cd7c3dfd97ad 100644 --- a/contrib/libarchive/unzip/test/test_d.c +++ b/contrib/libarchive/unzip/test/test_d.c @@ -9,6 +9,7 @@  /* Test d arg - extract to target dir - before zipfile argument */  DEFINE_TEST(test_d_before_zipfile)  { +#ifdef HAVE_LIBZ  	const char *reffile = "test_basic.zip";  	int r; @@ -22,11 +23,15 @@ DEFINE_TEST(test_d_before_zipfile)  	assertTextFileContents("contents b\n", "foobar/test_basic/b");  	assertTextFileContents("contents c\n", "foobar/test_basic/c");  	assertTextFileContents("contents CAPS\n", "foobar/test_basic/CAPS"); +#else +	skipping("zlib not available"); +#endif  }  /* Test d arg - extract to target dir - after zipfile argument */  DEFINE_TEST(test_d_after_zipfile)  { +#ifdef HAVE_LIBZ  	const char *reffile = "test_basic.zip";  	int r; @@ -40,4 +45,7 @@ DEFINE_TEST(test_d_after_zipfile)  	assertTextFileContents("contents b\n", "foobar/test_basic/b");  	assertTextFileContents("contents c\n", "foobar/test_basic/c");  	assertTextFileContents("contents CAPS\n", "foobar/test_basic/CAPS"); +#else +	skipping("zlib not available"); +#endif  } diff --git a/contrib/libarchive/unzip/test/test_doubledash.c b/contrib/libarchive/unzip/test/test_doubledash.c index 4467213dbb89..db0445ec3c24 100644 --- a/contrib/libarchive/unzip/test/test_doubledash.c +++ b/contrib/libarchive/unzip/test/test_doubledash.c @@ -9,6 +9,7 @@  /* Test double dash arg - swallow "--" and use next argument as file name  */  DEFINE_TEST(test_doubledash)  { +#ifdef HAVE_LIBZ  	const char *reffile = "test_basic.zip";  	int r; @@ -22,4 +23,7 @@ DEFINE_TEST(test_doubledash)  	assertTextFileContents("contents b\n", "test_basic/b");  	assertTextFileContents("contents c\n", "test_basic/c");  	assertTextFileContents("contents CAPS\n", "test_basic/CAPS"); +#else +	skipping("zlib not available"); +#endif  } diff --git a/contrib/libarchive/unzip/test/test_glob.c b/contrib/libarchive/unzip/test/test_glob.c index b53aa16fd85c..589ff1c55ef3 100644 --- a/contrib/libarchive/unzip/test/test_glob.c +++ b/contrib/libarchive/unzip/test/test_glob.c @@ -9,6 +9,7 @@  /* Test that the glob works */  DEFINE_TEST(test_glob)  { +#ifdef HAVE_LIBZ  	const char *reffile = "test_basic.zip";  	int r; @@ -22,4 +23,7 @@ DEFINE_TEST(test_glob)  	assertTextFileContents("contents b\n", "test_basic/b");  	assertFileNotExists("test_basic/c");  	assertFileNotExists("test_basic/CAPS"); +#else +	skipping("zlib not available"); +#endif  } diff --git a/contrib/libarchive/unzip/test/test_j.c b/contrib/libarchive/unzip/test/test_j.c index b87229f42e25..1fba8ca207ec 100644 --- a/contrib/libarchive/unzip/test/test_j.c +++ b/contrib/libarchive/unzip/test/test_j.c @@ -9,6 +9,7 @@  /* Test j arg - don't make directories */  DEFINE_TEST(test_j)  { +#ifdef HAVE_LIBZ  	const char *reffile = "test_basic.zip";  	int r; @@ -22,4 +23,7 @@ DEFINE_TEST(test_j)  	assertTextFileContents("contents b\n", "b");  	assertTextFileContents("contents c\n", "c");  	assertTextFileContents("contents CAPS\n", "CAPS"); +#else +	skipping("zlib not available"); +#endif  } diff --git a/contrib/libarchive/unzip/test/test_n.c b/contrib/libarchive/unzip/test/test_n.c index bb75c5d7696d..a13623ce23df 100644 --- a/contrib/libarchive/unzip/test/test_n.c +++ b/contrib/libarchive/unzip/test/test_n.c @@ -9,6 +9,7 @@  /* Test n arg - don't overwrite existing files */  DEFINE_TEST(test_n)  { +#ifdef HAVE_LIBZ  	const char *reffile = "test_basic.zip";  	int r; @@ -26,4 +27,7 @@ DEFINE_TEST(test_n)  	assertTextFileContents("orig b\n", "test_basic/b");  	assertTextFileContents("contents c\n", "test_basic/c");  	assertTextFileContents("contents CAPS\n", "test_basic/CAPS"); +#else +	skipping("zlib not available"); +#endif  } diff --git a/contrib/libarchive/unzip/test/test_o.c b/contrib/libarchive/unzip/test/test_o.c index 64f946774440..8c48348c41a4 100644 --- a/contrib/libarchive/unzip/test/test_o.c +++ b/contrib/libarchive/unzip/test/test_o.c @@ -9,6 +9,7 @@  /* Test o arg - overwrite existing files */  DEFINE_TEST(test_o)  { +#ifdef HAVE_LIBZ  	const char *reffile = "test_basic.zip";  	int r; @@ -25,4 +26,7 @@ DEFINE_TEST(test_o)  	assertTextFileContents("contents b\n", "test_basic/b");  	assertTextFileContents("contents c\n", "test_basic/c");  	assertTextFileContents("contents CAPS\n", "test_basic/CAPS"); +#else +	skipping("zlib not available"); +#endif  } diff --git a/contrib/libarchive/unzip/test/test_p.c b/contrib/libarchive/unzip/test/test_p.c index 8bfffbe5dc39..13a7765463ec 100644 --- a/contrib/libarchive/unzip/test/test_p.c +++ b/contrib/libarchive/unzip/test/test_p.c @@ -9,6 +9,7 @@  /* Test p arg - Print to stdout */  DEFINE_TEST(test_p)  { +#ifdef HAVE_LIBZ  	const char *reffile = "test_basic.zip";  	int r; @@ -17,4 +18,7 @@ DEFINE_TEST(test_p)  	assertEqualInt(0, r);  	assertTextFileContents("contents a\ncontents b\ncontents c\ncontents CAPS\n", "test.out");  	assertEmptyFile("test.err"); +#else +	skipping("zlib not available"); +#endif  } diff --git a/contrib/libarchive/unzip/test/test_q.c b/contrib/libarchive/unzip/test/test_q.c index 13222a483992..0579e8028d76 100644 --- a/contrib/libarchive/unzip/test/test_q.c +++ b/contrib/libarchive/unzip/test/test_q.c @@ -9,6 +9,7 @@  /* Test q arg - Quiet */  DEFINE_TEST(test_q)  { +#ifdef HAVE_LIBZ  	const char *reffile = "test_basic.zip";  	int r; @@ -22,4 +23,7 @@ DEFINE_TEST(test_q)  	assertTextFileContents("contents b\n", "test_basic/b");  	assertTextFileContents("contents c\n", "test_basic/c");  	assertTextFileContents("contents CAPS\n", "test_basic/CAPS"); +#else +	skipping("zlib not available"); +#endif  } diff --git a/contrib/libarchive/unzip/test/test_singlefile.c b/contrib/libarchive/unzip/test/test_singlefile.c index a72811f046d9..a5a35ecacc4d 100644 --- a/contrib/libarchive/unzip/test/test_singlefile.c +++ b/contrib/libarchive/unzip/test/test_singlefile.c @@ -9,6 +9,7 @@  /* Ensure single-file zips work */  DEFINE_TEST(test_singlefile)  { +#ifdef HAVE_LIBZ  	const char *reffile = "test_singlefile.zip";  	int r; @@ -19,4 +20,7 @@ DEFINE_TEST(test_singlefile)  	assertEmptyFile("test.err");  	assertTextFileContents("hello\n", "file.txt"); +#else +	skipping("zlib not available"); +#endif  } diff --git a/contrib/libarchive/unzip/test/test_t.c b/contrib/libarchive/unzip/test/test_t.c index 55a516fc636f..7565830915c3 100644 --- a/contrib/libarchive/unzip/test/test_t.c +++ b/contrib/libarchive/unzip/test/test_t.c @@ -9,6 +9,7 @@  /* Test t arg - Test zip contents */  DEFINE_TEST(test_t)  { +#ifdef HAVE_LIBZ  	const char *reffile = "test_basic.zip";  	int r; @@ -17,4 +18,7 @@ DEFINE_TEST(test_t)  	assertEqualInt(0, r);  	assertNonEmptyFile("test.out");  	assertEmptyFile("test.err"); +#else +	skipping("zlib not available"); +#endif  } diff --git a/contrib/libarchive/unzip/test/test_x.c b/contrib/libarchive/unzip/test/test_x.c index 959beb1950df..43a2085dc5b2 100644 --- a/contrib/libarchive/unzip/test/test_x.c +++ b/contrib/libarchive/unzip/test/test_x.c @@ -9,6 +9,7 @@  /* Test x arg with single exclude path */  DEFINE_TEST(test_x_single)  { +#ifdef HAVE_LIBZ  	const char *reffile = "test_basic.zip";  	int r; @@ -22,11 +23,15 @@ DEFINE_TEST(test_x_single)  	assertTextFileContents("contents b\n", "test_basic/b");  	assertFileNotExists("test_basic/c");  	assertTextFileContents("contents CAPS\n", "test_basic/CAPS"); +#else +	skipping("zlib not available"); +#endif  }  /* Test x arg with multiple exclude paths */  DEFINE_TEST(test_x_multiple)  { +#ifdef HAVE_LIBZ  	const char *reffile = "test_basic.zip";  	int r; @@ -40,11 +45,15 @@ DEFINE_TEST(test_x_multiple)  	assertFileNotExists("test_basic/b");  	assertFileNotExists("test_basic/c");  	assertTextFileContents("contents CAPS\n", "test_basic/CAPS"); +#else +	skipping("zlib not available"); +#endif  }  /* Test x arg with multiple exclude paths and a d arg afterwards */  DEFINE_TEST(test_x_multiple_with_d)  { +#ifdef HAVE_LIBZ  	const char *reffile = "test_basic.zip";  	int r; @@ -58,4 +67,7 @@ DEFINE_TEST(test_x_multiple_with_d)  	assertFileNotExists("foobar/test_basic/b");  	assertFileNotExists("foobar/test_basic/c");  	assertTextFileContents("contents CAPS\n", "foobar/test_basic/CAPS"); +#else +	skipping("zlib not available"); +#endif  } | 
