kill MFSNAMELEN

This commit is contained in:
christos 2007-07-17 20:03:10 +00:00
parent 6b725ae5ed
commit fede0a77fc
3 changed files with 18 additions and 16 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: df.c,v 1.75 2007/07/16 14:39:53 christos Exp $ */ /* $NetBSD: df.c,v 1.76 2007/07/17 20:03:10 christos Exp $ */
/* /*
* Copyright (c) 1980, 1990, 1993, 1994 * Copyright (c) 1980, 1990, 1993, 1994
@ -45,7 +45,7 @@ __COPYRIGHT(
#if 0 #if 0
static char sccsid[] = "@(#)df.c 8.7 (Berkeley) 4/2/94"; static char sccsid[] = "@(#)df.c 8.7 (Berkeley) 4/2/94";
#else #else
__RCSID("$NetBSD: df.c,v 1.75 2007/07/16 14:39:53 christos Exp $"); __RCSID("$NetBSD: df.c,v 1.76 2007/07/17 20:03:10 christos Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -69,7 +69,7 @@ int main(int, char *[]);
int bread(off_t, void *, int); int bread(off_t, void *, int);
char *getmntpt(char *); char *getmntpt(char *);
void prtstat(struct statvfs *, int); void prtstat(struct statvfs *, int);
int selected(const char *); int selected(const char *, size_t);
void maketypelist(char *); void maketypelist(char *);
long regetmntinfo(struct statvfs **, long); long regetmntinfo(struct statvfs **, long);
void usage(void); void usage(void);
@ -178,7 +178,8 @@ main(int argc, char *argv[])
warnx("Warning: %s is not a local %s", warnx("Warning: %s is not a local %s",
*argv, "file system"); *argv, "file system");
else if else if
(!selected(mntbuf[mntsize].f_fstypename)) (!selected(mntbuf[mntsize].f_fstypename,
sizeof(mntbuf[mntsize].f_fstypename)))
warnx("Warning: %s mounted as a %s %s", warnx("Warning: %s mounted as a %s %s",
*argv, *argv,
mntbuf[mntsize].f_fstypename, mntbuf[mntsize].f_fstypename,
@ -219,7 +220,7 @@ getmntpt(char *name)
static enum { IN_LIST, NOT_IN_LIST } which; static enum { IN_LIST, NOT_IN_LIST } which;
int int
selected(const char *type) selected(const char *type, size_t len)
{ {
char **av; char **av;
@ -227,7 +228,7 @@ selected(const char *type)
if (typelist == NULL) if (typelist == NULL)
return (1); return (1);
for (av = typelist; *av != NULL; ++av) for (av = typelist; *av != NULL; ++av)
if (!strncmp(type, *av, MFSNAMELEN)) if (!strncmp(type, *av, len))
return (which == IN_LIST ? 1 : 0); return (which == IN_LIST ? 1 : 0);
return (which == IN_LIST ? 0 : 1); return (which == IN_LIST ? 0 : 1);
} }
@ -291,7 +292,8 @@ regetmntinfo(struct statvfs **mntbufp, long mntsize)
continue; continue;
if (lflag && (mntbuf[i].f_flag & MNT_LOCAL) == 0) if (lflag && (mntbuf[i].f_flag & MNT_LOCAL) == 0)
continue; continue;
if (!selected(mntbuf[i].f_fstypename)) if (!selected(mntbuf[i].f_fstypename,
sizeof(mntbuf[i].f_fstypename)))
continue; continue;
if (nflag) if (nflag)
mntbuf[j] = mntbuf[i]; mntbuf[j] = mntbuf[i];

View File

@ -1,4 +1,4 @@
/* $NetBSD: opendir.c,v 1.31 2006/05/17 20:36:50 christos Exp $ */ /* $NetBSD: opendir.c,v 1.32 2007/07/17 20:05:17 christos Exp $ */
/* /*
* Copyright (c) 1983, 1993 * Copyright (c) 1983, 1993
@ -34,7 +34,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)opendir.c 8.7 (Berkeley) 12/10/94"; static char sccsid[] = "@(#)opendir.c 8.7 (Berkeley) 12/10/94";
#else #else
__RCSID("$NetBSD: opendir.c,v 1.31 2006/05/17 20:36:50 christos Exp $"); __RCSID("$NetBSD: opendir.c,v 1.32 2007/07/17 20:05:17 christos Exp $");
#endif #endif
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
@ -112,11 +112,11 @@ __opendir2(const char *name, int flags)
if (flags & DTF_NODUP) if (flags & DTF_NODUP)
unionstack = !(strncmp(sfb.f_fstypename, MOUNT_UNION, unionstack = !(strncmp(sfb.f_fstypename, MOUNT_UNION,
MFSNAMELEN)) || (sfb.f_flag & MNT_UNION); sizeof(sfb.f_fstypename))) || (sfb.f_flag & MNT_UNION);
else else
unionstack = 0; unionstack = 0;
nfsdir = !(strncmp(sfb.f_fstypename, MOUNT_NFS, MFSNAMELEN)); nfsdir = !(strncmp(sfb.f_fstypename, MOUNT_NFS, sizeof(sfb.f_fstypename)));
if (unionstack || nfsdir) { if (unionstack || nfsdir) {
size_t len; size_t len;

View File

@ -1,4 +1,4 @@
/* $NetBSD: fsck.c,v 1.45 2006/12/13 16:08:26 christos Exp $ */ /* $NetBSD: fsck.c,v 1.46 2007/07/17 20:12:40 christos Exp $ */
/* /*
* Copyright (c) 1996 Christos Zoulas. All rights reserved. * Copyright (c) 1996 Christos Zoulas. All rights reserved.
@ -36,7 +36,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: fsck.c,v 1.45 2006/12/13 16:08:26 christos Exp $"); __RCSID("$NetBSD: fsck.c,v 1.46 2007/07/17 20:12:40 christos Exp $");
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>
@ -379,7 +379,7 @@ selected(const char *type)
/* If no type specified, it's always selected. */ /* If no type specified, it's always selected. */
TAILQ_FOREACH(e, &selhead, entries) TAILQ_FOREACH(e, &selhead, entries)
if (!strncmp(e->type, type, MFSNAMELEN)) if (!strcmp(e->type, type))
return which == IN_LIST ? 1 : 0; return which == IN_LIST ? 1 : 0;
return which == IN_LIST ? 0 : 1; return which == IN_LIST ? 0 : 1;
@ -392,7 +392,7 @@ getoptions(const char *type)
struct entry *e; struct entry *e;
TAILQ_FOREACH(e, &opthead, entries) TAILQ_FOREACH(e, &opthead, entries)
if (!strncmp(e->type, type, MFSNAMELEN)) if (!strcmp(e->type, type))
return e->options; return e->options;
return ""; return "";
} }
@ -410,7 +410,7 @@ addoption(char *optstr)
*newoptions++ = '\0'; *newoptions++ = '\0';
TAILQ_FOREACH(e, &opthead, entries) TAILQ_FOREACH(e, &opthead, entries)
if (!strncmp(e->type, optstr, MFSNAMELEN)) { if (!strcmp(e->type, optstr)) {
catopt(&e->options, newoptions); catopt(&e->options, newoptions);
return; return;
} }