Skip to content

Commit 89712ff

Browse files
committed
unzip: use lchmod() and optreset only if available (fix Android build)
Fixes libarchive#1921
1 parent a122717 commit 89712ff

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

unzip/bsdunzip.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,8 +694,10 @@ extract_file(struct archive *a, struct archive_entry *e, char **path)
694694
if (symlink(linkname, *path) != 0)
695695
error("symlink('%s')", *path);
696696
info(" extracting: %s -> %s\n", *path, linkname);
697+
#ifdef HAVE_LCHMOD
697698
if (lchmod(*path, mode) != 0)
698699
warning("Cannot set mode for '%s'", *path);
700+
#endif
699701
/* set access and modification time */
700702
if (utimensat(AT_FDCWD, *path, ts, AT_SYMLINK_NOFOLLOW) != 0)
701703
warning("utimensat('%s')", *path);
@@ -1053,7 +1055,10 @@ getopts(int argc, char *argv[])
10531055
{
10541056
int opt;
10551057

1056-
optreset = optind = 1;
1058+
optind = 1;
1059+
#ifdef HAVE_GETOPT_OPTRESET
1060+
optreset = 1;
1061+
#endif
10571062
while ((opt = getopt(argc, argv, "aCcd:fjLlnopP:qtuvx:yZ1")) != -1)
10581063
switch (opt) {
10591064
case '1':

0 commit comments

Comments
 (0)