Date: Tue, 24 Dec 2002 15:33:39 -0800 (PST) From: Robert Watson <rwatson@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 22725 for review Message-ID: <200212242333.gBONXdwa029626@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=22725 Change 22725 by rwatson@rwatson_paprika on 2002/12/24 15:33:31 Adapt gzip to maintain ACLs before/after gzip and gunzip. Patches submitted by Chris Faulhaber. Affected files ... .. //depot/projects/trustedbsd/acl/gnu/usr.bin/gzip/Makefile#2 edit .. //depot/projects/trustedbsd/acl/gnu/usr.bin/gzip/gzip.c#2 edit Differences ... ==== //depot/projects/trustedbsd/acl/gnu/usr.bin/gzip/Makefile#2 (text+ko) ==== @@ -4,7 +4,7 @@ PROG= gzip SRCS= gzip.c zip.c deflate.c trees.c bits.c unzip.c inflate.c util.c \ crypt.c lzw.c unlzw.c unlzh.c unpack.c getopt.c -CFLAGS+=-DSTDC_HEADERS=1 -DHAVE_UNISTD_H=1 -DDIRENT=1 +CFLAGS+=-DSTDC_HEADERS=1 -DHAVE_UNISTD_H=1 -DDIRENT=1 -DWITH_ACL_SUPPORT .if ${MACHINE_ARCH} == "i386" SRCS+= match.S CFLAGS+=-DASMV ==== //depot/projects/trustedbsd/acl/gnu/usr.bin/gzip/gzip.c#2 (text+ko) ==== @@ -50,6 +50,9 @@ #include <ctype.h> #include <sys/types.h> +#ifdef WITH_ACL_SUPPORT +#include <sys/acl.h> +#endif #include <signal.h> #include <sys/stat.h> #include <errno.h> @@ -1626,6 +1629,9 @@ local void copy_stat(ifstat) struct stat *ifstat; { +#ifdef WITH_ACL_SUPPORT + acl_t acl; +#endif #ifndef NO_UTIME if (decompress && time_stamp != 0 && ifstat->st_mtime != time_stamp) { ifstat->st_mtime = time_stamp; @@ -1643,6 +1649,16 @@ #ifndef NO_CHOWN chown(ofname, ifstat->st_uid, ifstat->st_gid); /* Copy ownership */ #endif +#ifdef WITH_ACL_SUPPORT + /* Copy the ACL */ + acl = acl_get_file(ifname, ACL_TYPE_ACCESS); + if (acl != NULL) { + if (acl_set_file(ofname, ACL_TYPE_ACCESS, acl) == -1 && + errno != EOPNOTSUPP && !quiet) + warn("failed to set the ACL on %s", ofname); + acl_free(acl); + } +#endif remove_ofname = 0; /* It's now safe to remove the input file: */ if (unlink(ifname)) { To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200212242333.gBONXdwa029626>
