# --- ROCK-COPYRIGHT-NOTE-BEGIN --- # # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # Please add additional copyright information _after_ the line containing # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by # the ./scripts/Create-CopyPatch script. Do not edit this copyright text! # # ROCK Linux: rock-src/package/base/gzip/gzip-1.3.5-gzip-perm.patch # ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # # --- ROCK-COPYRIGHT-NOTE-END --- --- gzip-1.3.5/gzip.c.perm 2005-04-26 14:22:58.211395152 +0200 +++ gzip-1.3.5/gzip.c 2005-04-26 14:24:10.414418624 +0200 @@ -881,6 +881,20 @@ } close(ifd); + /* ofd ownership and permissions have to be set before close(ofd)*/ + if (!to_stdout) { + if (fchmod(ofd, istat.st_mode & 07777)) { + int e = errno; + WARN((stderr, "%s: ", progname)); + if (!quiet) { + errno = e; + perror(ofname); + } + } +#ifndef NO_CHOWN + fchown(ofd, istat.st_uid, istat.st_gid); /* Copy ownership */ +#endif + } if (!to_stdout && close(ofd)) { write_error(); } @@ -902,7 +916,7 @@ } fprintf(stderr, "\n"); } - /* Copy modes, times, ownership, and remove the input file */ + /* Copy times and remove the input file */ if (!to_stdout) { copy_stat(&istat); } @@ -1715,7 +1729,7 @@ /* ======================================================================== - * Copy modes, times, ownership from input file to output file. + * Copy times from input file to output file. * IN assertion: to_stdout is false. */ local void copy_stat(ifstat) @@ -1730,18 +1744,6 @@ } reset_times(ofname, ifstat); #endif - /* Copy the protection modes */ - if (chmod(ofname, ifstat->st_mode & 07777)) { - int e = errno; - WARN((stderr, "%s: ", progname)); - if (!quiet) { - errno = e; - perror(ofname); - } - } -#ifndef NO_CHOWN - chown(ofname, ifstat->st_uid, ifstat->st_gid); /* Copy ownership */ -#endif remove_ofname = 0; /* It's now safe to remove the input file: */ if (xunlink (ifname)) {