From: Martin Matuska Date: Tue, 18 Jul 2023 13:41:43 +0000 (+0200) Subject: unzip: use lchmod() and optreset only if available (fix Android build) X-Git-Tag: v3.7.1~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=89712ffa6ede364f261dcd9208adabf068e2e21c;p=thirdparty%2Flibarchive.git unzip: use lchmod() and optreset only if available (fix Android build) Fixes #1921 --- 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':