Generally don't need the extra byte in MAXPATHLEN sized buffers, because

pathnames are guaranteed by POSIX to be MAXPATHLEN-1 bytes long.
Kindly pointed out by Warner Losh in private email.
This commit is contained in:
lukem 2001-11-09 06:55:56 +00:00
parent 47514a31be
commit 704b08b696
4 changed files with 13 additions and 13 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: compare.c,v 1.34 2001/11/07 08:01:52 lukem Exp $ */
/* $NetBSD: compare.c,v 1.35 2001/11/09 06:55:56 lukem Exp $ */
/*-
* Copyright (c) 1989, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)compare.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: compare.c,v 1.34 2001/11/07 08:01:52 lukem Exp $");
__RCSID("$NetBSD: compare.c,v 1.35 2001/11/09 06:55:56 lukem Exp $");
#endif
#endif /* not lint */
@ -435,7 +435,7 @@ compare(NODE *s, FTSENT *p)
const char *
rlink(const char *name)
{
static char lbuf[MAXPATHLEN + 1];
static char lbuf[MAXPATHLEN];
int len;
if ((len = readlink(name, lbuf, sizeof(lbuf) - 1)) == -1)

View File

@ -1,4 +1,4 @@
/* $NetBSD: mtree.c,v 1.24 2001/11/07 08:01:52 lukem Exp $ */
/* $NetBSD: mtree.c,v 1.25 2001/11/09 06:55:56 lukem Exp $ */
/*-
* Copyright (c) 1989, 1990, 1993
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1990, 1993\n\
#if 0
static char sccsid[] = "@(#)mtree.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: mtree.c,v 1.24 2001/11/07 08:01:52 lukem Exp $");
__RCSID("$NetBSD: mtree.c,v 1.25 2001/11/09 06:55:56 lukem Exp $");
#endif
#endif /* not lint */
@ -63,7 +63,7 @@ __RCSID("$NetBSD: mtree.c,v 1.24 2001/11/07 08:01:52 lukem Exp $");
int ftsoptions = FTS_PHYSICAL;
int cflag, dflag, Dflag, eflag, iflag, lflag, mflag,
rflag, sflag, tflag, uflag, Uflag;
char fullpath[MAXPATHLEN + 1];
char fullpath[MAXPATHLEN];
int main(int, char **);
static void usage(void);
@ -181,7 +181,7 @@ main(int argc, char **argv)
if (dir && chdir(dir))
mtree_err("%s: %s", dir, strerror(errno));
if ((cflag || sflag) && !getcwd(fullpath, sizeof(fullpath) - 1))
if ((cflag || sflag) && !getcwd(fullpath, sizeof(fullpath)))
mtree_err("%s", strerror(errno));
if (cflag == 1 && Dflag == 1)

View File

@ -1,4 +1,4 @@
/* $NetBSD: spec.c,v 1.40 2001/11/07 08:01:52 lukem Exp $ */
/* $NetBSD: spec.c,v 1.41 2001/11/09 06:55:56 lukem Exp $ */
/*-
* Copyright (c) 1989, 1993
@ -74,7 +74,7 @@
#if 0
static char sccsid[] = "@(#)spec.c 8.2 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: spec.c,v 1.40 2001/11/07 08:01:52 lukem Exp $");
__RCSID("$NetBSD: spec.c,v 1.41 2001/11/09 06:55:56 lukem Exp $");
#endif
#endif /* not lint */
@ -253,7 +253,7 @@ void
dump_nodes(const char *dir, NODE *root)
{
NODE *cur;
char path[MAXPATHLEN + 1];
char path[MAXPATHLEN];
const char *name;
for (cur = root; cur != NULL; cur = cur->next) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: verify.c,v 1.24 2001/11/07 08:01:52 lukem Exp $ */
/* $NetBSD: verify.c,v 1.25 2001/11/09 06:55:56 lukem Exp $ */
/*-
* Copyright (c) 1990, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)verify.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: verify.c,v 1.24 2001/11/07 08:01:52 lukem Exp $");
__RCSID("$NetBSD: verify.c,v 1.25 2001/11/09 06:55:56 lukem Exp $");
#endif
#endif /* not lint */
@ -58,7 +58,7 @@ __RCSID("$NetBSD: verify.c,v 1.24 2001/11/07 08:01:52 lukem Exp $");
#include "extern.h"
static NODE *root;
static char path[MAXPATHLEN + 1];
static char path[MAXPATHLEN];
static void miss(NODE *, char *);
static int vwalk(void);