From d241a89d5ca55ce9966df813da27f7702700c7d8 Mon Sep 17 00:00:00 2001 From: "Tim J. Robbins" Date: Sat, 14 Dec 2002 11:44:54 +0000 Subject: [PATCH] Update pathchk to reflect the fact that 1003.1-2001 now includes the trailing null byte in PATH_MAX and _POSIX_PATH_MAX. PR: 46035 --- usr.bin/pathchk/pathchk.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/usr.bin/pathchk/pathchk.c b/usr.bin/pathchk/pathchk.c index a0ef92a41f7..d1561858b20 100644 --- a/usr.bin/pathchk/pathchk.c +++ b/usr.bin/pathchk/pathchk.c @@ -157,6 +157,8 @@ check(const char *path) pathmax = PATH_MAX; } else pathmax = _POSIX_PATH_MAX; + /* PATH_MAX includes space for the trailing null byte. */ + pathmax--; if (pathmax != -1 && strlen(path) > (size_t)pathmax) { warnx("%s: path too long (limit %ld)", path, pathmax); goto bad;