]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
which: Use size_t instead of ssize_t for pathlen
authorCollin Funk <collin.funk1@gmail.com>
Sun, 11 Feb 2024 04:26:38 +0000 (20:26 -0800)
committerMark Johnston <markj@FreeBSD.org>
Fri, 5 Apr 2024 18:30:31 +0000 (14:30 -0400)
commit8268a31bcceb9ebe32d380cab792c89c5d897d15
tree715d22a2e04bf3c36b77ae54a819654b7f84079e
parentda2b732288c72b347b128e1fa9a169c7bba3beb8
which: Use size_t instead of ssize_t for pathlen

The "pathlen" variable is the return value of strlen(3) and is then
passed as an argument to malloc(3) and memcpy(3). The size_t type
matches the prototype for these functions. The size_t type is unsigned
so it can fit larger $PATH values than ssize_t. However, in practice
ssize_t should be larger enough so this change is just for clarity.

Signed-off-by: Collin Funk <collin.funk1@gmail.com>
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/1113
usr.bin/which/which.c