summaryrefslogtreecommitdiffstats
path: root/usr.bin/pathchk
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2002-12-14 11:44:54 +0000
committertjr <tjr@FreeBSD.org>2002-12-14 11:44:54 +0000
commit6f784b854cab669d46feb316fa7b22ee8a2d8c53 (patch)
tree9a9fe9122348f53c354775c7578965140b2538d3 /usr.bin/pathchk
parent5512694b2561b1ca275008a0533e083483bd8256 (diff)
downloadFreeBSD-src-6f784b854cab669d46feb316fa7b22ee8a2d8c53.zip
FreeBSD-src-6f784b854cab669d46feb316fa7b22ee8a2d8c53.tar.gz
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
Diffstat (limited to 'usr.bin/pathchk')
-rw-r--r--usr.bin/pathchk/pathchk.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/usr.bin/pathchk/pathchk.c b/usr.bin/pathchk/pathchk.c
index a0ef92a..d156185 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;
OpenPOWER on IntegriCloud