diff --git a/bin/df/df.c b/bin/df/df.c index 10f22f311679..f9533553412e 100644 --- a/bin/df/df.c +++ b/bin/df/df.c @@ -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 @@ -45,7 +45,7 @@ __COPYRIGHT( #if 0 static char sccsid[] = "@(#)df.c 8.7 (Berkeley) 4/2/94"; #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 /* not lint */ @@ -69,7 +69,7 @@ int main(int, char *[]); int bread(off_t, void *, int); char *getmntpt(char *); void prtstat(struct statvfs *, int); -int selected(const char *); +int selected(const char *, size_t); void maketypelist(char *); long regetmntinfo(struct statvfs **, long); void usage(void); @@ -178,7 +178,8 @@ main(int argc, char *argv[]) warnx("Warning: %s is not a local %s", *argv, "file system"); 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", *argv, mntbuf[mntsize].f_fstypename, @@ -219,7 +220,7 @@ getmntpt(char *name) static enum { IN_LIST, NOT_IN_LIST } which; int -selected(const char *type) +selected(const char *type, size_t len) { char **av; @@ -227,7 +228,7 @@ selected(const char *type) if (typelist == NULL) return (1); 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 ? 0 : 1); } @@ -291,7 +292,8 @@ regetmntinfo(struct statvfs **mntbufp, long mntsize) continue; if (lflag && (mntbuf[i].f_flag & MNT_LOCAL) == 0) continue; - if (!selected(mntbuf[i].f_fstypename)) + if (!selected(mntbuf[i].f_fstypename, + sizeof(mntbuf[i].f_fstypename))) continue; if (nflag) mntbuf[j] = mntbuf[i]; diff --git a/lib/libc/gen/opendir.c b/lib/libc/gen/opendir.c index d4785fcbf154..92c84a04f325 100644 --- a/lib/libc/gen/opendir.c +++ b/lib/libc/gen/opendir.c @@ -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 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)opendir.c 8.7 (Berkeley) 12/10/94"; #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 /* LIBC_SCCS and not lint */ @@ -112,11 +112,11 @@ __opendir2(const char *name, int flags) if (flags & DTF_NODUP) unionstack = !(strncmp(sfb.f_fstypename, MOUNT_UNION, - MFSNAMELEN)) || (sfb.f_flag & MNT_UNION); + sizeof(sfb.f_fstypename))) || (sfb.f_flag & MNT_UNION); else unionstack = 0; - nfsdir = !(strncmp(sfb.f_fstypename, MOUNT_NFS, MFSNAMELEN)); + nfsdir = !(strncmp(sfb.f_fstypename, MOUNT_NFS, sizeof(sfb.f_fstypename))); if (unionstack || nfsdir) { size_t len; diff --git a/sbin/fsck/fsck.c b/sbin/fsck/fsck.c index c58d0eaecdad..a5ec70fec5f9 100644 --- a/sbin/fsck/fsck.c +++ b/sbin/fsck/fsck.c @@ -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. @@ -36,7 +36,7 @@ #include #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 */ #include @@ -379,7 +379,7 @@ selected(const char *type) /* If no type specified, it's always selected. */ 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 ? 0 : 1; @@ -392,7 +392,7 @@ getoptions(const char *type) struct entry *e; TAILQ_FOREACH(e, &opthead, entries) - if (!strncmp(e->type, type, MFSNAMELEN)) + if (!strcmp(e->type, type)) return e->options; return ""; } @@ -410,7 +410,7 @@ addoption(char *optstr) *newoptions++ = '\0'; TAILQ_FOREACH(e, &opthead, entries) - if (!strncmp(e->type, optstr, MFSNAMELEN)) { + if (!strcmp(e->type, optstr)) { catopt(&e->options, newoptions); return; }