diff -ru unzip-5.52/unix/unix.c ../BUILD/unzip-5.52-fix/unix/unix.c --- unzip-5.52/unix/unix.c 2005-10-03 07:58:18.000000000 +0000 +++ unzip-5.52-fix/unix/unix.c 2005-10-03 08:04:44.000000000 +0000 @@ -1043,6 +1043,17 @@ int have_uidgid_flg; fchmod(fileno(G.outfile), 0400); + +/*--------------------------------------------------------------------------- + Change the file permissions from default ones to those stored in the + zipfile. It is necessary to change permissions before fclose command. + ---------------------------------------------------------------------------*/ + +#ifndef NO_CHMOD + if (fchmod(fileno(G.outfile), 0xffff & G.pInfo->file_attr)) + perror("chmod (file attributes) error"); +#endif + fclose(G.outfile); /*--------------------------------------------------------------------------- @@ -1154,17 +1165,6 @@ " (warning) cannot set times")); #endif /* ?AOS_VS */ } - -/*--------------------------------------------------------------------------- - Change the file permissions from default ones to those stored in the - zipfile. - ---------------------------------------------------------------------------*/ - -#ifndef NO_CHMOD - if (chmod(G.filename, filtattr(__G__ G.pInfo->file_attr))) - perror("chmod (file attributes) error"); -#endif - } /* end function close_outfile() */ #endif /* !MTS */