man: the exists function needs to validate the first parameter

This fixes an issue with the ".so " macro for FreeBSD
ports manual pages.

PR: 275978
Reported by:	Jamie Landeg-Jones <jamie@catflap.org>
MFC after:	1 week

Differential Revision:	https://reviews.freebsd.org/D45231 (discussion)
This commit is contained in:
Wolfram Schneider 2024-05-20 16:02:21 +00:00
parent 6edb14c006
commit 37be4197f7

View file

@ -201,6 +201,10 @@ decho() {
# Returns true if glob resolves to a real file and store the first
# found filename in the variable $found
exists() {
if [ -z "$1" ]; then
return 1
fi
local IFS
# Don't accidentally inherit callers IFS (breaks perl manpages)