From 89712ffa6ede364f261dcd9208adabf068e2e21c Mon Sep 17 00:00:00 2001 From: Martin Matuska Date: Tue, 18 Jul 2023 15:41:43 +0200 Subject: [PATCH] unzip: use lchmod() and optreset only if available (fix Android build) Fixes #1921 --- unzip/bsdunzip.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/unzip/bsdunzip.c b/unzip/bsdunzip.c index 469c69fd6..7a3758f6a 100644 --- a/unzip/bsdunzip.c +++ b/unzip/bsdunzip.c @@ -694,8 +694,10 @@ recheck: if (symlink(linkname, *path) != 0) error("symlink('%s')", *path); info(" extracting: %s -> %s\n", *path, linkname); +#ifdef HAVE_LCHMOD if (lchmod(*path, mode) != 0) warning("Cannot set mode for '%s'", *path); +#endif /* set access and modification time */ if (utimensat(AT_FDCWD, *path, ts, AT_SYMLINK_NOFOLLOW) != 0) warning("utimensat('%s')", *path); @@ -1053,7 +1055,10 @@ getopts(int argc, char *argv[]) { int opt; - optreset = optind = 1; + optind = 1; +#ifdef HAVE_GETOPT_OPTRESET + optreset = 1; +#endif while ((opt = getopt(argc, argv, "aCcd:fjLlnopP:qtuvx:yZ1")) != -1) switch (opt) { case '1': -- 2.47.2