PERFORCE change 22725 for review

Robert Watson rwatson at freebsd.org
Tue Dec 24 23:33:39 GMT 2002


http://perforce.freebsd.org/chv.cgi?CH=22725

Change 22725 by rwatson at 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 at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message



More information about the trustedbsd-cvs mailing list