From 8339e4f43d63e80f6cba0c1d49e9d1f40384c1fd Mon Sep 17 00:00:00 2001 From: Bruce Evans Date: Tue, 20 Jan 1998 13:52:32 +0000 Subject: [PATCH] Converted to Lite2 mount interface - don't use numeric filesystem types. The NetBSD compatibility cruft was more correct for -current than FreeBSD's own code. It just used NetBSD #defines instead of string literals for the filesystem names. NetBSD's MOUNT_UFS is "ffs", so using a literal "ufs" gives wrong results, but this is unimportant, especially for bootstrapping. Fixed style bugs in trymmap(). Fixed some disordered declarations. --- usr.bin/xinstall/xinstall.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/usr.bin/xinstall/xinstall.c b/usr.bin/xinstall/xinstall.c index 2a6c0624d3c..2e1f8b81f58 100644 --- a/usr.bin/xinstall/xinstall.c +++ b/usr.bin/xinstall/xinstall.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "From: @(#)xinstall.c 8.1 (Berkeley) 7/21/93"; #endif static const char rcsid[] = - "$Id: xinstall.c,v 1.29 1998/01/11 11:43:36 peter Exp $"; + "$Id: xinstall.c,v 1.30 1998/01/13 02:12:43 alex Exp $"; #endif /* not lint */ /*- @@ -87,7 +87,7 @@ static const char rcsid[] = #define MAP_FAILED ((void *)-1) /* from */ #endif -int debug, docompare, docopy, dodir, dopreserve, dostrip, verbose, nommap; +int debug, docompare, docopy, dodir, dopreserve, dostrip, nommap, verbose; int mode = S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH; char *group, *owner, pathbuf[MAXPATHLEN]; char pathbuf2[MAXPATHLEN]; @@ -712,22 +712,18 @@ int trymmap(fd) int fd; { +/* + * The ifdef is for bootstrapping - f_fstypename doesn't exist in + * pre-Lite2-merge systems. + */ +#ifdef MFSNAMELEN struct statfs stfs; - if (nommap || fstatfs(fd, &stfs) < 0) - return 0; - -/* NetBSD MOUNT_XXX defines are strings, but doesn't have a MOUNT_NONE. */ -#ifdef MOUNT_NONE - switch(stfs.f_type) { - case MOUNT_UFS: /* should be safe.. */ - case MOUNT_CD9660: /* should be safe.. */ - return 1; - } -#else - if (strcmp(stfs.f_fstypename,MOUNT_UFS) == 0 || - strcmp(stfs.f_fstypename,MOUNT_CD9660) == 0) - return 1; + if (nommap || fstatfs(fd, &stfs) != 0) + return (0); + if (strcmp(stfs.f_fstypename, "ufs") == 0 || + strcmp(stfs.f_fstypename, "cd9660") == 0) + return (1); #endif - return 0; + return (0); }