Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/mtree Generally don't need the extra byte in MAXPAT...
details: https://anonhg.NetBSD.org/src/rev/391a571ac908
branches: trunk
changeset: 517241:391a571ac908
user: lukem <lukem%NetBSD.org@localhost>
date: Fri Nov 09 06:55:56 2001 +0000
description:
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.
diffstat:
usr.sbin/mtree/compare.c | 6 +++---
usr.sbin/mtree/mtree.c | 8 ++++----
usr.sbin/mtree/spec.c | 6 +++---
usr.sbin/mtree/verify.c | 6 +++---
4 files changed, 13 insertions(+), 13 deletions(-)
diffs (117 lines):
diff -r e9c0576fb1ab -r 391a571ac908 usr.sbin/mtree/compare.c
--- a/usr.sbin/mtree/compare.c Fri Nov 09 06:52:23 2001 +0000
+++ b/usr.sbin/mtree/compare.c Fri Nov 09 06:55:56 2001 +0000
@@ -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 @@
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)
diff -r e9c0576fb1ab -r 391a571ac908 usr.sbin/mtree/mtree.c
--- a/usr.sbin/mtree/mtree.c Fri Nov 09 06:52:23 2001 +0000
+++ b/usr.sbin/mtree/mtree.c Fri Nov 09 06:55:56 2001 +0000
@@ -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 @@
#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 @@
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 @@
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)
diff -r e9c0576fb1ab -r 391a571ac908 usr.sbin/mtree/spec.c
--- a/usr.sbin/mtree/spec.c Fri Nov 09 06:52:23 2001 +0000
+++ b/usr.sbin/mtree/spec.c Fri Nov 09 06:55:56 2001 +0000
@@ -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 @@
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) {
diff -r e9c0576fb1ab -r 391a571ac908 usr.sbin/mtree/verify.c
--- a/usr.sbin/mtree/verify.c Fri Nov 09 06:52:23 2001 +0000
+++ b/usr.sbin/mtree/verify.c Fri Nov 09 06:55:56 2001 +0000
@@ -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 @@
#include "extern.h"
static NODE *root;
-static char path[MAXPATHLEN + 1];
+static char path[MAXPATHLEN];
static void miss(NODE *, char *);
static int vwalk(void);
Home |
Main Index |
Thread Index |
Old Index