PERFORCE change 77308 for review

Peter Wemm peter at FreeBSD.org
Sun May 22 16:25:03 GMT 2005


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

Change 77308 by peter at peter_overcee on 2005/05/22 16:24:18

	IFC @77306

Affected files ...

.. //depot/projects/hammer/contrib/telnet/telnetd/telnetd.c#4 integrate
.. //depot/projects/hammer/lib/libarchive/Makefile#22 integrate
.. //depot/projects/hammer/lib/libarchive/archive_platform.h#9 integrate
.. //depot/projects/hammer/lib/libarchive/archive_read.3#15 integrate
.. //depot/projects/hammer/lib/libarchive/archive_read_extract.c#22 integrate
.. //depot/projects/hammer/lib/libarchive/configure.ac.in#4 integrate
.. //depot/projects/hammer/sbin/ipfw/ipfw2.c#42 integrate
.. //depot/projects/hammer/sbin/kldstat/kldstat.c#7 integrate
.. //depot/projects/hammer/share/man/man4/bge.4#14 integrate
.. //depot/projects/hammer/share/man/man4/mac_bsdextended.4#10 integrate
.. //depot/projects/hammer/share/man/man4/pcm.4#12 integrate
.. //depot/projects/hammer/sys/amd64/amd64/exception.S#35 integrate
.. //depot/projects/hammer/sys/conf/files.sparc64#30 integrate
.. //depot/projects/hammer/sys/conf/options.sparc64#9 integrate
.. //depot/projects/hammer/sys/dev/bge/if_bge.c#45 integrate
.. //depot/projects/hammer/sys/dev/bge/if_bgereg.h#24 integrate
.. //depot/projects/hammer/sys/dev/fb/boot_font.c#3 integrate
.. //depot/projects/hammer/sys/dev/fb/creator.c#6 integrate
.. //depot/projects/hammer/sys/dev/fb/gfb.c#4 integrate
.. //depot/projects/hammer/sys/dev/fb/machfb.c#1 branch
.. //depot/projects/hammer/sys/dev/fb/machfbreg.h#1 branch
.. //depot/projects/hammer/sys/dev/fb/tga.c#4 integrate
.. //depot/projects/hammer/sys/dev/syscons/scgfbrndr.c#4 integrate
.. //depot/projects/hammer/sys/dev/syscons/scvtb.c#5 integrate
.. //depot/projects/hammer/sys/dev/syscons/syscons.c#30 integrate
.. //depot/projects/hammer/sys/dev/syscons/syscons.h#7 integrate
.. //depot/projects/hammer/sys/dev/uart/uart_kbd_sun.c#4 integrate
.. //depot/projects/hammer/sys/dev/vkbd/vkbd.c#7 integrate
.. //depot/projects/hammer/sys/netinet/tcp_output.c#31 integrate
.. //depot/projects/hammer/sys/netinet/tcp_timer.c#16 integrate
.. //depot/projects/hammer/sys/netinet/tcp_usrreq.c#30 integrate
.. //depot/projects/hammer/sys/netinet/tcp_var.h#29 integrate
.. //depot/projects/hammer/sys/powerpc/ofw/ofw_syscons.c#7 integrate
.. //depot/projects/hammer/sys/sparc64/conf/GENERIC#38 integrate
.. //depot/projects/hammer/sys/sparc64/conf/NOTES#15 integrate
.. //depot/projects/hammer/sys/sparc64/creator/creator.h#3 integrate
.. //depot/projects/hammer/sys/sparc64/creator/creator_upa.c#7 integrate
.. //depot/projects/hammer/sys/sparc64/sparc64/nexus.c#11 integrate
.. //depot/projects/hammer/sys/sparc64/sparc64/ofw_machdep.c#11 integrate
.. //depot/projects/hammer/sys/sparc64/sparc64/sc_machdep.c#2 integrate
.. //depot/projects/hammer/sys/sys/fbio.h#5 integrate
.. //depot/projects/hammer/sys/vm/swap_pager.c#40 integrate
.. //depot/projects/hammer/sys/vm/vm_glue.c#40 integrate
.. //depot/projects/hammer/usr.bin/asa/asa.c#2 integrate
.. //depot/projects/hammer/usr.bin/brandelf/brandelf.c#3 integrate
.. //depot/projects/hammer/usr.bin/c89/c89.1#3 integrate
.. //depot/projects/hammer/usr.bin/c89/c89.c#2 integrate
.. //depot/projects/hammer/usr.bin/c99/c99.1#4 integrate
.. //depot/projects/hammer/usr.bin/c99/c99.c#3 integrate
.. //depot/projects/hammer/usr.bin/catman/catman.c#9 integrate
.. //depot/projects/hammer/usr.bin/colldef/parse.y#5 integrate
.. //depot/projects/hammer/usr.bin/dirname/dirname.c#2 integrate
.. //depot/projects/hammer/usr.bin/du/du.1#6 integrate
.. //depot/projects/hammer/usr.bin/finger/finger.c#6 integrate
.. //depot/projects/hammer/usr.bin/from/from.1#2 integrate
.. //depot/projects/hammer/usr.bin/fstat/fstat.c#15 integrate
.. //depot/projects/hammer/usr.bin/ktrdump/ktrdump.c#7 integrate
.. //depot/projects/hammer/usr.bin/lastcomm/lastcomm.c#5 integrate
.. //depot/projects/hammer/usr.bin/mesg/mesg.c#3 integrate
.. //depot/projects/hammer/usr.bin/newkey/newkey.c#3 integrate
.. //depot/projects/hammer/usr.bin/nice/nice.c#3 integrate
.. //depot/projects/hammer/usr.bin/pathchk/pathchk.c#3 integrate
.. //depot/projects/hammer/usr.bin/printf/printf.c#8 integrate
.. //depot/projects/hammer/usr.bin/renice/renice.c#3 integrate
.. //depot/projects/hammer/usr.bin/rsh/rsh.c#7 integrate
.. //depot/projects/hammer/usr.bin/rup/rup.c#3 integrate
.. //depot/projects/hammer/usr.bin/ruptime/ruptime.c#3 integrate
.. //depot/projects/hammer/usr.bin/rusers/rusers.c#4 integrate
.. //depot/projects/hammer/usr.bin/rwall/rwall.c#4 integrate
.. //depot/projects/hammer/usr.bin/showmount/showmount.c#5 integrate
.. //depot/projects/hammer/usr.bin/time/time.c#5 integrate
.. //depot/projects/hammer/usr.bin/truncate/truncate.c#3 integrate
.. //depot/projects/hammer/usr.bin/ul/ul.1#7 integrate
.. //depot/projects/hammer/usr.bin/ul/ul.c#4 integrate
.. //depot/projects/hammer/usr.bin/unifdef/unifdef.1#6 integrate
.. //depot/projects/hammer/usr.bin/unifdef/unifdef.c#8 integrate
.. //depot/projects/hammer/usr.bin/vmstat/vmstat.c#17 integrate
.. //depot/projects/hammer/usr.bin/write/write.1#5 integrate
.. //depot/projects/hammer/usr.bin/xargs/xargs.1#8 integrate
.. //depot/projects/hammer/usr.bin/xstr/xstr.1#5 integrate
.. //depot/projects/hammer/usr.bin/xstr/xstr.c#5 integrate
.. //depot/projects/hammer/usr.bin/ypcat/ypcat.c#3 integrate
.. //depot/projects/hammer/usr.bin/ypmatch/ypmatch.c#3 integrate

Differences ...

==== //depot/projects/hammer/contrib/telnet/telnetd/telnetd.c#4 (text+ko) ====

@@ -37,7 +37,7 @@
 #endif
 #endif
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/contrib/telnet/telnetd/telnetd.c,v 1.27 2005/01/09 10:24:46 maxim Exp $");
+__FBSDID("$FreeBSD: src/contrib/telnet/telnetd/telnetd.c,v 1.28 2005/05/21 15:28:42 ume Exp $");
 
 #include "telnetd.h"
 #include "pathnames.h"
@@ -695,7 +695,7 @@
 	if (!isdigit(remote_hostname[0]) && strlen(remote_hostname) > utmp_len)
 		err_ = getnameinfo(who, who->sa_len, remote_hostname,
 				  sizeof(remote_hostname), NULL, 0,
-				  NI_NUMERICHOST|NI_WITHSCOPEID);
+				  NI_NUMERICHOST);
 		/* XXX: do 'err_' check */
 
 	(void) gethostname(host_name, sizeof(host_name) - 1);

==== //depot/projects/hammer/lib/libarchive/Makefile#22 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/lib/libarchive/Makefile,v 1.34 2005/04/23 17:56:34 kientzle Exp $
+# $FreeBSD: src/lib/libarchive/Makefile,v 1.35 2005/05/21 19:45:56 kientzle Exp $
 
 #
 # Use "make distfile" to build a conventional tar.gz archive
@@ -7,7 +7,7 @@
 
 
 LIB=	archive
-VERSION=	1.02.019
+VERSION=	1.02.023
 ARCHIVE_API_FEATURE=	2
 ARCHIVE_API_VERSION=	1
 SHLIB_MAJOR=	${ARCHIVE_API_VERSION}

==== //depot/projects/hammer/lib/libarchive/archive_platform.h#9 (text+ko) ====

@@ -23,7 +23,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/lib/libarchive/archive_platform.h,v 1.14 2005/04/23 17:56:34 kientzle Exp $
+ * $FreeBSD: src/lib/libarchive/archive_platform.h,v 1.15 2005/05/21 19:45:56 kientzle Exp $
  */
 
 /*
@@ -46,6 +46,8 @@
 #if __FreeBSD__ > 4
 #define	HAVE_ACL_CREATE_ENTRY 1
 #define	HAVE_ACL_INIT 1
+#define	HAVE_ACL_SET_FD 1
+#define	HAVE_ACL_SET_FD_NP 1
 #define	HAVE_ACL_SET_FILE 1
 #endif
 #define	HAVE_BZLIB_H 1
@@ -55,7 +57,10 @@
 #define	HAVE_EILSEQ 1
 #define	HAVE_ERRNO_H 1
 #define	HAVE_FCHDIR 1
+#define	HAVE_FCHMOD 1
+#define	HAVE_FCHOWN 1
 #define	HAVE_FCNTL_H 1
+#define	HAVE_FUTIMES 1
 #define	HAVE_INTTYPES_H 1
 #define	HAVE_LCHMOD 1
 #define	HAVE_LCHOWN 1
@@ -123,6 +128,14 @@
 #define	HAVE_POSIX_ACL	1
 #endif
 
+/*
+ * If we can't restore metadata using a file descriptor, then
+ * for compatibility's sake, close files before trying to restore metadata.
+ */
+#if defined(HAVE_FCHMOD) || defined(HAVE_FUTIMES) || defined(HAVE_ACL_SET_FD) || defined(HAVE_ACL_SET_FD_NP) || defined(HAVE_FCHOWN)
+#define CAN_RESTORE_METADATA_FD
+#endif
+
 /* Set up defaults for internal error codes. */
 #ifndef ARCHIVE_ERRNO_FILE_FORMAT
 #if HAVE_EFTYPE

==== //depot/projects/hammer/lib/libarchive/archive_read.3#15 (text+ko) ====

@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/lib/libarchive/archive_read.3,v 1.19 2005/02/13 22:25:11 ru Exp $
+.\" $FreeBSD: src/lib/libarchive/archive_read.3,v 1.20 2005/05/21 19:38:19 kientzle Exp $
 .\"
 .Dd January 8, 2005
 .Dt archive_read 3
@@ -389,7 +389,7 @@
   struct mydata *mydata = client_data;
 
   mydata->fd = open(mydata->name, O_RDONLY);
-  return (mydata->fd >= 0);
+  return (mydata->fd >= 0 ? ARCHIVE_OK : ARCHIVE_FATAL);
 }
 
 int
@@ -399,7 +399,7 @@
 
   if (mydata->fd > 0)
     close(mydata->fd);
-  return (0);
+  return (ARCHIVE_OK);
 }
 .Ed
 .Sh RETURN VALUES

==== //depot/projects/hammer/lib/libarchive/archive_read_extract.c#22 (text+ko) ====

@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003-2004 Tim Kientzle
+ * Copyright (c) 2003-2005 Tim Kientzle
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -25,7 +25,7 @@
  */
 
 #include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_extract.c,v 1.39 2005/04/17 22:49:00 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_extract.c,v 1.40 2005/05/21 19:45:56 kientzle Exp $");
 
 #include <sys/types.h>
 #ifdef HAVE_SYS_ACL_H
@@ -94,9 +94,6 @@
 	 * Cached stat data from disk for the current entry.
 	 * If this is valid, pst points to st.  Otherwise,
 	 * pst is null.
-	 *
-	 * TODO: Have all of the stat calls use this cached data
-	 * if possible.
 	 */
 	struct stat		 st;
 	struct stat		*pst;
@@ -130,19 +127,20 @@
 static int	create_dir_recursive(struct archive *, char *, int flags);
 static int	create_parent_dir(struct archive *, const char *, int flags);
 static int	create_parent_dir_mutable(struct archive *, char *, int flags);
-static int	restore_metadata(struct archive *, struct archive_entry *,
-		    int flags);
+static int	restore_metadata(struct archive *, int fd,
+		    struct archive_entry *, int flags);
 #ifdef HAVE_POSIX_ACL
-static int	set_acl(struct archive *, struct archive_entry *,
+static int	set_acl(struct archive *, int fd, struct archive_entry *,
 		    acl_type_t, int archive_entry_acl_type, const char *tn);
 #endif
-static int	set_acls(struct archive *, struct archive_entry *);
-static int	set_fflags(struct archive *, const char *name, mode_t mode,
+static int	set_acls(struct archive *, int fd, struct archive_entry *);
+static int	set_fflags(struct archive *, int fd, const char *name, mode_t,
 		    unsigned long fflags_set, unsigned long fflags_clear);
-static int	set_ownership(struct archive *, struct archive_entry *, int);
-static int	set_perm(struct archive *, struct archive_entry *, int mode,
+static int	set_ownership(struct archive *, int fd, struct archive_entry *,
 		    int flags);
-static int	set_time(struct archive *, struct archive_entry *, int);
+static int	set_perm(struct archive *, int fd, struct archive_entry *,
+		    int mode, int flags);
+static int	set_time(struct archive *, int fd, struct archive_entry *, int);
 static struct fixup_entry *sort_dir_list(struct fixup_entry *p);
 
 
@@ -183,6 +181,8 @@
 	restore_pwd = -1;
 	original_filename = NULL;
 
+	/* The following is not possible without fchdir.  <sigh> */
+#ifdef HAVE_FCHDIR
 	/*
 	 * If pathname is longer than PATH_MAX, record starting directory
 	 * and chdir to a suitable intermediate dir.
@@ -190,13 +190,19 @@
 	if (strlen(archive_entry_pathname(entry)) > PATH_MAX) {
 		char *intdir, *tail;
 
+		restore_pwd = open(".", O_RDONLY);
+		if (restore_pwd < 0) {
+				archive_set_error(a, errno,
+				    "Unable to restore long pathname");
+				return (ARCHIVE_WARN);
+		}
+
 		/*
 		 * Yes, the copy here is necessary because we edit
 		 * the pathname in-place to create intermediate dirnames.
 		 */
 		original_filename = strdup(archive_entry_pathname(entry));
 
-		restore_pwd = open(".", O_RDONLY);
 		/*
 		 * "intdir" points to the initial dir section we're going
 		 * to remove, "tail" points to the remainder of the path.
@@ -230,6 +236,7 @@
 		}
 		archive_entry_set_pathname(entry, tail);
 	}
+#endif
 
 	if (stat(archive_entry_pathname(entry), &extract->st) == 0)
 		extract->pst = &extract->st;
@@ -269,6 +276,7 @@
 
 
 cleanup:
+#ifdef HAVE_FCHDIR
 	/* If we changed directory above, restore it here. */
 	if (restore_pwd >= 0 && original_filename != NULL) {
 		fchdir(restore_pwd);
@@ -276,6 +284,7 @@
 		archive_entry_copy_pathname(entry, original_filename);
 		free(original_filename);
 	}
+#endif
 
 	return (ret);
 }
@@ -287,7 +296,7 @@
  *     dir, so we restore the dir 0700 first, then correct the
  *     mode at the end.
  *   * Similarly, the act of restoring a file touches the directory
- *     and changes the timestamp on the dir, so we have to touch-up the
+ *     and changes the timestamp on the dir, so we have to touch-up dir
  *     timestamps at the end as well.
  *   * Some file flags can interfere with the restore by, for example,
  *     preventing the creation of hardlinks to those files.
@@ -316,7 +325,7 @@
 	p = sort_dir_list(extract->fixup_list);
 
 	while (p != NULL) {
-		extract->pst = NULL; /* Mark stat buff as out-of-date. */
+		extract->pst = NULL; /* Mark stat cache as out-of-date. */
 		if (p->fixup & FIXUP_TIMES) {
 			struct timeval times[2];
 			times[1].tv_sec = p->mtime;
@@ -329,7 +338,7 @@
 			chmod(p->name, p->mode);
 
 		if (p->fixup & FIXUP_FFLAGS)
-			set_fflags(a, p->name, p->mode, p->fflags_set, 0);
+			set_fflags(a, -1, p->name, p->mode, p->fflags_set, 0);
 
 		next = p->next;
 		free(p->name);
@@ -482,9 +491,9 @@
 		return (ARCHIVE_WARN);
 	}
 	r = archive_read_data_into_fd(a, fd);
+	extract->pst = NULL; /* Cached stat data no longer valid. */
+	r2 = restore_metadata(a, fd, entry, flags);
 	close(fd);
-	extract->pst = NULL; /* Cached stat data no longer valid. */
-	r2 = restore_metadata(a, entry, flags);
 	return (err_combine(r, r2));
 }
 
@@ -503,28 +512,40 @@
 	    archive_entry_pathname(entry));
 	path = extract->create_parent_dir.s;
 
+	if (*path == '\0') {
+		archive_set_error(a, ARCHIVE_ERRNO_MISC,
+		    "Invalid empty pathname");
+		return (ARCHIVE_WARN);
+	}
+
 	/* Deal with any troublesome trailing path elements. */
+	/* TODO: Someday, generalize this to remove '//' or '/./' from
+	 * the middle of paths.  But, it should not compress '..' from
+	 * the middle of paths.  It's a feature that restoring
+	 * "a/../b" creates both 'a' and 'b' directories. */
 	for (;;) {
-		if (*path == '\0')
-			return (ARCHIVE_OK);
-		/* Locate last element; trim trailing '/'. */
+		/* Locate last element. */
 		p = strrchr(path, '/');
-		if (p != NULL) {
-			if (p[1] == '\0') {
-				*p = '\0';
-				continue;
-			}
+		if (p != NULL)
 			p++;
-		} else
+		else
 			p = path;
-		/* Trim trailing '.'. */
-		if (p[0] == '.' && p[1] == '\0') {
+		/* Trim trailing '/' unless that's the entire path. */
+		if (p[0] == '\0' && p - 1 > path) {
+			p[-1] = '\0';
+			continue;
+		}
+		/* Trim trailing '.' unless that's the entire path. */
+		if (p > path && p[0] == '.' && p[1] == '\0') {
 			p[0] = '\0';
 			continue;
 		}
 		/* Just exit on trailing '..'. */
-		if (p[0] == '.' && p[1] == '.' && p[2] == '\0')
-			return (ARCHIVE_OK);
+		if (p[0] == '.' && p[1] == '.' && p[2] == '\0') {
+			archive_set_error(a, ARCHIVE_ERRNO_MISC,
+			    "Can't restore directory '..'");
+			return (ARCHIVE_WARN);
+		}
 		break;
 	}
 
@@ -570,7 +591,7 @@
 	}
 	/* For now, set the mode to SECURE_DIR_MODE. */
 	archive_entry_set_mode(entry, SECURE_DIR_MODE);
-	return (restore_metadata(a, entry, flags));
+	return (restore_metadata(a, -1, entry, flags));
 }
 
 
@@ -762,7 +783,7 @@
 	}
 
 	/* Set ownership, time, permission information. */
-	r = restore_metadata(a, entry, flags);
+	r = restore_metadata(a, -1, entry, flags);
 	return (r);
 }
 
@@ -798,7 +819,7 @@
 		return (ARCHIVE_WARN);
 	}
 
-	r = restore_metadata(a, entry, flags);
+	r = restore_metadata(a, -1, entry, flags);
 	return (r);
 }
 
@@ -830,7 +851,7 @@
 		return (ARCHIVE_WARN);
 	}
 
-	r = restore_metadata(a, entry, flags);
+	r = restore_metadata(a, -1, entry, flags);
 	return (r);
 }
 
@@ -879,24 +900,25 @@
 		return (ARCHIVE_WARN);
 	}
 
-	r = restore_metadata(a, entry, flags);
+	r = restore_metadata(a, -1, entry, flags);
 	return (r);
 }
 
 static int
-restore_metadata(struct archive *a, struct archive_entry *entry, int flags)
+restore_metadata(struct archive *a, int fd, struct archive_entry *entry, int flags)
 {
 	int r, r2;
 
-	r = set_ownership(a, entry, flags);
-	r2 = set_time(a, entry, flags);
+	r = set_ownership(a, fd, entry, flags);
+	r2 = set_time(a, fd, entry, flags);
 	r = err_combine(r, r2);
-	r2 = set_perm(a, entry, archive_entry_mode(entry), flags);
+	r2 = set_perm(a, fd, entry, archive_entry_mode(entry), flags);
 	return (err_combine(r, r2));
 }
 
 static int
-set_ownership(struct archive *a, struct archive_entry *entry, int flags)
+set_ownership(struct archive *a, int fd,
+    struct archive_entry *entry, int flags)
 {
 	uid_t uid;
 	gid_t gid;
@@ -914,6 +936,11 @@
 	if (a->user_uid != 0  &&  a->user_uid != uid)
 		return (ARCHIVE_OK);
 
+#ifdef HAVE_FCHOWN
+	if (fd >= 0 && fchown(fd, uid, gid) == 0)
+		return (ARCHIVE_OK);
+#endif
+
 #ifdef HAVE_LCHOWN
 	if (lchown(archive_entry_pathname(entry), uid, gid))
 #else
@@ -930,7 +957,7 @@
 }
 
 static int
-set_time(struct archive *a, struct archive_entry *entry, int flags)
+set_time(struct archive *a, int fd, struct archive_entry *entry, int flags)
 {
 	const struct stat *st;
 	struct timeval times[2];
@@ -950,6 +977,11 @@
 	times[0].tv_sec = st->st_atime;
 	times[0].tv_usec = ARCHIVE_STAT_ATIME_NANOS(st) / 1000;
 
+#ifdef HAVE_FUTIMES
+	if (fd >= 0 && futimes(fd, times) == 0)
+		return (ARCHIVE_OK);
+#endif
+
 #ifdef HAVE_LUTIMES
 	if (lutimes(archive_entry_pathname(entry), times) != 0) {
 #else
@@ -973,7 +1005,8 @@
 }
 
 static int
-set_perm(struct archive *a, struct archive_entry *entry, int mode, int flags)
+set_perm(struct archive *a, int fd, struct archive_entry *entry,
+    int mode, int flags)
 {
 	struct extract *extract;
 	struct fixup_entry *le;
@@ -990,11 +1023,20 @@
 	name = archive_entry_pathname(entry);
 
 	if (mode & (S_ISUID | S_ISGID)) {
-		if (extract->pst == NULL && stat(name, &extract->st) != 0) {
-			archive_set_error(a, errno, "Can't check ownership");
+		if (extract->pst != NULL) {
+			/* Already have stat() data available. */
+#ifdef HAVE_FSTAT
+		} else if (fd >= 0 && fstat(fd, &extract->st) == 0) {
+			extract->pst = &extract->st;
+#endif
+		} else if (stat(name, &extract->st) == 0) {
+			extract->pst = &extract->st;
+		} else {
+			archive_set_error(a, errno,
+			    "Couldn't stat file");
 			return (ARCHIVE_WARN);
 		}
-		extract->pst = &extract->st;
+
 		/*
 		 * TODO: Use the uid/gid looked up in set_ownership
 		 * above rather than the uid/gid stored in the entry.
@@ -1011,6 +1053,10 @@
 	 * the way.
 	 */
 	if (!S_ISLNK(archive_entry_mode(entry))) {
+#ifdef HAVE_FCHMOD
+		if (fd >= 0 && fchmod(fd, mode) == 0)
+			return (ARCHIVE_OK);
+#endif
 		if (chmod(name, mode) != 0) {
 			archive_set_error(a, errno, "Can't set permissions");
 			return (ARCHIVE_WARN);
@@ -1030,7 +1076,7 @@
 	}
 
 	if (flags & ARCHIVE_EXTRACT_ACL) {
-		r = set_acls(a, entry);
+		r = set_acls(a, fd, entry);
 		if (r != ARCHIVE_OK)
 			return (r);
 	}
@@ -1086,7 +1132,7 @@
 			if ((le->fixup & FIXUP_MODE) == 0)
 				le->mode = mode;
 		} else {
-			r = set_fflags(a, archive_entry_pathname(entry),
+			r = set_fflags(a, fd, archive_entry_pathname(entry),
 			    mode, set, clear);
 			if (r != ARCHIVE_OK)
 				return (r);
@@ -1095,24 +1141,18 @@
 	return (ARCHIVE_OK);
 }
 
+
+#if defined(HAVE_CHFLAGS) && !defined(__linux)
 static int
-set_fflags(struct archive *a, const char *name, mode_t mode,
+set_fflags(struct archive *a, int fd, const char *name, mode_t mode,
     unsigned long set, unsigned long clear)
 {
 	struct extract *extract;
-	int		 ret;
-#ifdef linux
-	int		 fd;
-	int		 err;
-	unsigned long newflags, oldflags;
-#endif
 
 	extract = a->extract;
-	ret = ARCHIVE_OK;
 	if (set == 0  && clear == 0)
-		return (ret);
+		return (ARCHIVE_OK);
 
-#ifdef HAVE_CHFLAGS
 	(void)mode; /* UNUSED */
 	/*
 	 * XXX Is the stat here really necessary?  Or can I just use
@@ -1120,65 +1160,99 @@
 	 * about the correct approach if we're overwriting an existing
 	 * file that already has flags on it. XXX
 	 */
-	if (stat(name, &extract->st) == 0) {
-		extract->st.st_flags &= ~clear;
-		extract->st.st_flags |= set;
-		if (chflags(name, extract->st.st_flags) != 0) {
-			archive_set_error(a, errno,
-			    "Failed to set file flags");
-			ret = ARCHIVE_WARN;
-		}
+	if (extract->pst != NULL) {
+		/* Already have stat() data available. */
+	} else if (fd >= 0 && fstat(fd, &extract->st) == 0)
+		extract->pst = &extract->st;
+	else if (stat(name, &extract->st) == 0)
 		extract->pst = &extract->st;
+	else {
+		archive_set_error(a, errno,
+		    "Couldn't stat file");
+		return (ARCHIVE_WARN);
 	}
-#else
-#ifdef linux
-	/* Linux has flags too, but no chflags syscall */
+
+	extract->st.st_flags &= ~clear;
+	extract->st.st_flags |= set;
+	if (chflags(name, extract->st.st_flags) == 0)
+		return (ARCHIVE_OK);
+
+	archive_set_error(a, errno,
+	    "Failed to set file flags");
+	return (ARCHIVE_WARN);
+}
+#endif /* HAVE_CHFLAGS */
+
+#ifdef __linux
+/* Linux has flags too, but uses ioctl() instead of chflags(). */
+static int
+set_fflags(struct archive *a, int fd, const char *name, mode_t mode,
+    unsigned long set, unsigned long clear)
+{
+	struct extract *extract;
+	int		 ret;
+	int		 myfd = fd;
+	int		 err;
+	unsigned long newflags, oldflags;
+
+	extract = a->extract;
+	ret = ARCHIVE_OK;
+	if (set == 0  && clear == 0)
+		return (ret);
+	/* Only regular files and dirs can have flags. */
+	if (!S_ISREG(mode) && !S_ISDIR(mode))
+		return (ret);
+
+	/* If we weren't given an fd, open it ourselves. */
+	if (myfd < 0)
+		myfd = open(name, O_RDONLY|O_NONBLOCK);
+	if (myfd < 0)
+		return (ret);
+
 	/*
 	 * Linux has no define for the flags that are only settable
 	 * by the root user...
 	 */
 #define	SF_MASK                 (EXT2_IMMUTABLE_FL|EXT2_APPEND_FL)
-
 	/*
 	 * XXX As above, this would be way simpler if we didn't have
 	 * to read the current flags from disk. XXX
 	 */
-	if ((S_ISREG(mode) || S_ISDIR(mode)) &&
-	    ((fd = open(name, O_RDONLY|O_NONBLOCK)) >= 0)) {
-		err = 1;
-		if (fd >= 0 && (ioctl(fd, EXT2_IOC_GETFLAGS, &oldflags) >= 0)) {
-			newflags = (oldflags & ~clear) | set;
-			if (ioctl(fd, EXT2_IOC_SETFLAGS, &newflags) >= 0) {
-				err = 0;
-			} else if (errno == EPERM) {
-				if (ioctl(fd, EXT2_IOC_GETFLAGS, &oldflags) >= 0) {
-					newflags &= ~SF_MASK;
-					oldflags &= SF_MASK;
-					newflags |= oldflags;
-					if (ioctl(fd, EXT2_IOC_SETFLAGS, &newflags) >= 0)
-						err = 0;
-				}
-			}
-		}
-		close(fd);
-		if (err) {
-			archive_set_error(a, errno,
-			    "Failed to set file flags");
-			ret = ARCHIVE_WARN;
-		}
+	/* Try setting the flags as given. */
+	if (ioctl(myfd, EXT2_IOC_GETFLAGS, &oldflags) >= 0) {
+		newflags = (oldflags & ~clear) | set;
+		if (ioctl(myfd, EXT2_IOC_SETFLAGS, &newflags) >= 0)
+			goto cleanup;
+		if (errno != EPERM)
+			goto fail;
+	}
+	/* If we couldn't set all the flags, try again with a subset. */
+	if (ioctl(myfd, EXT2_IOC_GETFLAGS, &oldflags) >= 0) {
+		newflags &= ~SF_MASK;
+		oldflags &= SF_MASK;
+		newflags |= oldflags;
+		if (ioctl(myfd, EXT2_IOC_SETFLAGS, &newflags) >= 0)
+			goto cleanup;
 	}
-#endif /* linux */
-#endif /* HAVE_CHFLAGS */
-
+	/* We couldn't set the flags, so report the failure. */
+fail:
+	archive_set_error(a, errno,
+	    "Failed to set file flags");
+	ret = ARCHIVE_WARN;
+cleanup:
+	if (fd < 0)
+		close(myfd);
 	return (ret);
 }
+#endif /* __linux */
 
 #ifndef HAVE_POSIX_ACL
 /* Default empty function body to satisfy mainline code. */
 static int
-set_acls(struct archive *a, struct archive_entry *entry)
+set_acls(struct archive *a, int fd, struct archive_entry *entry)
 {
 	(void)a;
+	(void)fd;
 	(void)entry;
 
 	return (ARCHIVE_OK);
@@ -1190,23 +1264,23 @@
  * XXX TODO: What about ACL types other than ACCESS and DEFAULT?
  */
 static int
-set_acls(struct archive *a, struct archive_entry *entry)
+set_acls(struct archive *a, int fd, struct archive_entry *entry)
 {
 	int		 ret;
 
-	ret = set_acl(a, entry, ACL_TYPE_ACCESS,
+	ret = set_acl(a, fd, entry, ACL_TYPE_ACCESS,
 	    ARCHIVE_ENTRY_ACL_TYPE_ACCESS, "access");
 	if (ret != ARCHIVE_OK)
 		return (ret);
-	ret = set_acl(a, entry, ACL_TYPE_DEFAULT,
+	ret = set_acl(a, fd, entry, ACL_TYPE_DEFAULT,
 	    ARCHIVE_ENTRY_ACL_TYPE_DEFAULT, "default");
 	return (ret);
 }
 
 
 static int
-set_acl(struct archive *a, struct archive_entry *entry, acl_type_t acl_type,
-    int ae_requested_type, const char *typename)
+set_acl(struct archive *a, int fd, struct archive_entry *entry,
+    acl_type_t acl_type, int ae_requested_type, const char *typename)
 {
 	acl_t		 acl;
 	acl_entry_t	 acl_entry;
@@ -1268,6 +1342,17 @@
 
 	name = archive_entry_pathname(entry);
 
+	/* Try restoring the ACL through 'fd' if we can. */
+#if HAVE_ACL_SET_FD
+	if (fd >= 0 && acl_type == ACL_TYPE_ACCESS && acl_set_fd(fd, acl) == 0)
+		ret = ARCHIVE_OK;
+	else
+#endif
+#if HAVE_ACL_SET_FD_NP
+	if (fd >= 0 && acl_set_fd_np(fd, acl, acl_type) == 0)
+		ret = ARCHIVE_OK;
+	else
+#endif
 	if (acl_set_file(name, acl_type, acl) != 0) {
 		archive_set_error(a, errno, "Failed to set %s acl", typename);
 		ret = ARCHIVE_WARN;

==== //depot/projects/hammer/lib/libarchive/configure.ac.in#4 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/lib/libarchive/configure.ac.in,v 1.4 2005/04/23 17:56:34 kientzle Exp $
+# $FreeBSD: src/lib/libarchive/configure.ac.in,v 1.5 2005/05/21 19:45:56 kientzle Exp $
 
 #Process this file with autoconf to produce a configure script.
 AC_INIT(libarchive, @VERSION@, kientzle at freebsd.org)
@@ -72,8 +72,9 @@
 AC_FUNC_MEMCMP
 AC_FUNC_STAT
 AC_FUNC_STRERROR_R
-AC_CHECK_FUNCS([acl_create_entry acl_init acl_set_file])
-AC_CHECK_FUNCS([chflags fchdir lchmod lchown lutimes memmove])
+AC_CHECK_FUNCS([acl_create_entry acl_init acl_set_fd acl_set_fd_np acl_set_file])
+AC_CHECK_FUNCS([chflags fchdir fchmod fchown futimes])
+AC_CHECK_FUNCS([lchmod lchown lutimes memmove])
 AC_CHECK_FUNCS([memset mkdir mkfifo strchr strdup strerror strrchr])
 
 # Additional requirements

==== //depot/projects/hammer/sbin/ipfw/ipfw2.c#42 (text+ko) ====

@@ -17,7 +17,7 @@
  *
  * NEW command line interface for IP firewall facility
  *
- * $FreeBSD: src/sbin/ipfw/ipfw2.c,v 1.73 2005/04/26 20:22:31 brooks Exp $
+ * $FreeBSD: src/sbin/ipfw/ipfw2.c,v 1.74 2005/05/21 03:27:33 mlaier Exp $
  */
 
 #include <sys/param.h>
@@ -3511,7 +3511,7 @@
 		; /* all done! */
 	else if ((pe = getprotobyname(av)) != NULL)
 		*proto = pe->p_proto;
-	else if (strcmp(av, "ipv6") == 0 || strcmp(av, "ip6"))
+	else if (strcmp(av, "ipv6") == 0 || strcmp(av, "ip6") == 0)
 		*proto = IPPROTO_IPV6;
 	else
 		return NULL;
@@ -4433,7 +4433,6 @@
 
 		case TOK_IPV6:
 			fill_cmd(cmd, O_IP6, 0, 0);
-			ac--; av++;
 			break;
 
 		case TOK_EXT6HDR:

==== //depot/projects/hammer/sbin/kldstat/kldstat.c#7 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sbin/kldstat/kldstat.c,v 1.16 2005/05/04 12:46:43 fjoe Exp $");
+__FBSDID("$FreeBSD: src/sbin/kldstat/kldstat.c,v 1.17 2005/05/21 07:08:32 ru Exp $");
 
 #include <err.h>
 #include <stdint.h>
@@ -76,7 +76,8 @@
 static void
 usage(void)
 {
-    fprintf(stderr, "usage: kldstat [-v] [-i id] [-n name] [-m name]\n");
+    fprintf(stderr, "usage: kldstat [-v] [-i id] [-n filename]\n");
+    fprintf(stderr, "       kldstat [-m modname]\n");
     exit(1);
 }
 

==== //depot/projects/hammer/share/man/man4/bge.4#14 (text+ko) ====

@@ -29,14 +29,14 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 .\" THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/share/man/man4/bge.4,v 1.17 2005/05/20 01:20:23 brueffer Exp $
+.\" $FreeBSD: src/share/man/man4/bge.4,v 1.18 2005/05/22 10:27:51 brueffer Exp $
 .\"
-.Dd May 20, 2005
+.Dd May 22, 2005
 .Dt BGE 4
 .Os
 .Sh NAME
 .Nm bge
-.Nd "Broadcom BCM570x/5714/5721/5750/5751 PCI Gigabit Ethernet adapter driver"
+.Nd "Broadcom BCM570x/5714/5721/5750/5751/5789 PCI Gigabit Ethernet adapter driver"
 .Sh SYNOPSIS
 .Cd "device miibus"
 .Cd "device bge"
@@ -44,7 +44,7 @@
 The
 .Nm
 driver provides support for various NICs based on the Broadcom BCM570x,
-5714, 5721, 5750 and 5751 families of Gigabit Ethernet controller chips.
+5714, 5721, 5750, 5751 and 5789 families of Gigabit Ethernet controller chips.
 .Pp
 All of these NICs are capable of 10, 100 and 1000Mbps speeds over CAT5
 copper cable, except for the SysKonnect SK-9D41 which supports only

==== //depot/projects/hammer/share/man/man4/mac_bsdextended.4#10 (text+ko) ====

@@ -28,9 +28,9 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/share/man/man4/mac_bsdextended.4,v 1.15 2005/04/11 16:53:40 trhodes Exp $
+.\" $FreeBSD: src/share/man/man4/mac_bsdextended.4,v 1.16 2005/05/21 17:22:12 trhodes Exp $
 .\"
-.Dd September 10, 2004
+.Dd May 21, 2005
 .Os
 .Dt MAC_BSDEXTENDED 4
 .Sh NAME
@@ -95,7 +95,7 @@
 .Nm :
 .Bl -tag -width indent
 .It Va security.mac.bsdextended.enabled
-Set to zero or one to toggle the policy on or off.
+Set to zero or one to toggle the policy off or on.
 .It Va security.mac.bsdextended.rule_count
 List the number of defined rules, the maximum rule count is
 current set at 256.

==== //depot/projects/hammer/share/man/man4/pcm.4#12 (text+ko) ====

@@ -23,9 +23,9 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/share/man/man4/pcm.4,v 1.38 2005/01/21 08:36:37 ru Exp $
+.\" $FreeBSD: src/share/man/man4/pcm.4,v 1.39 2005/05/22 15:25:14 brueffer Exp $
 .\"
-.Dd August 28, 2004
+.Dd May 22, 2005
 .Dt SOUND 4
 .Os
 .Sh NAME
@@ -266,37 +266,32 @@
 for a complete list of the supported
 .Fn ioctl
 functions.
-.Ss Supported Cards
-Below we include a list of supported codecs/cards.
-If your sound card
-is not listed here, it may be supported by a bridge driver.
-.Bl -tag -width 2m
-.It CS4237, CS4236, CS4232, CS4231 (ISA)
-All these cards work perfectly in full duplex using the MSS mode.
-This chipset is used, among others, on the A/Open AW35 and AW32, on
-some Intel motherboards, and (the CS4231) on some non-PnP cards.
+.Sh HARDWARE
+The
+.Nm
+driver supports the following sound cards:
 .Pp
-The CS4232 is reported as buggy in the Voxware documentation but
-I am not sure if this is true.
-On one of my Intel motherboards,
-capture does not work simply because the capture DMA channel is
-not wired to the ISA DMA controller.
-.It Yamaha OPL-SAx (ISA)
-Works perfectly in all modes.
-This chip is used in several PnP cards,
-but also (in non-PnP mode) on motherboards and laptops (e.g., the
-Toshiba Libretto).
-.It OPTi931 (ISA)
-The chip is buggy, but the driver has many workarounds to make it work
-in full duplex because for some time these were the only full duplex
-cards I could find.
-U-law format uses U8 format internally because of
-a bug in the chip.
-.It Trident 4DWave DX/NX (PCI)
-.It ENSONIQ AudioPCI ES1370/1371 (PCI)
-Creative Labs SoundBlaster PCI is supported as well.
-.It ESS Solo-1/1E (PCI)
-.It NeoMagic 256AV/ZX (PCI)
+.Bl -bullet -compact
+.It
+CS4231, CS4232, CS4236, CS4237 (ISA)
+.It
+Creative Labs SoundBlaster PCI
+.It
+ENSONIQ AudioPCI ES1370/1371
+.It
+ESS Solo-1/1E (PCI)
+.It
+Intel 443MX, 810, 815, and 815E integrated sound devices
+.It
+MSS/WSS Compatible DSPs
+.It
+NeoMagic 256AV/ZK (PCI)
+.It
+OPTi931/82C931 (ISA)
+.It
+Trident 4DWave DX/NX (PCI)
+.It
+Yamaha OPL-SAx (ISA)
 .El
 .Sh FILES
 The
@@ -342,9 +337,28 @@
 A device node is not created properly.
 .El
 .Sh SEE ALSO
+.Xr snd_ad1816 4 ,

>>> TRUNCATED FOR MAIL (1000 lines) <<<


More information about the p4-projects mailing list