whereis: fix fetching of user.cs_path sysctl variable
authorStefan Eßer <se@FreeBSD.org>
Fri, 4 Feb 2022 22:37:12 +0000 (23:37 +0100)
committerStefan Eßer <se@FreeBSD.org>
Fri, 4 Feb 2022 22:44:34 +0000 (23:44 +0100)
commitc454c57163574ace86b49626b06637e93e05d5e6
tree41b16be03eea0ff49efc983e79adba5271f3449c
parent7510633e76cf66ceea6a4b27d0892535f73e3ad5
whereis: fix fetching of user.cs_path sysctl variable

The current implementation of sysctlbyname() does not support the user
sub-tree. This function exits with a return value of 0, but sets the
passed string buffer to an empty string.

As a result, the whereis program did not use the value of the sysctl
variable "user.cs_path", but only the value of the environment
variable "PATH".

This update makes whereis use the sysctl function with a fixed OID,
which already supports the user sub-tree.

MFC after: 3 days
usr.bin/whereis/whereis.c