mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-31 03:51:14 -03:00
Explicitly check for KERN_PROC_PATHNAME
While FreeBSD, DragonflyBSD, and NetBSD have KERN_PROC_PATHNAME, OpenBSD does not.
This commit is contained in:
@@ -1995,7 +1995,7 @@ std::string get_executable_path(const char *argv0) {
|
||||
// https://opensource.apple.com/source/adv_cmds/adv_cmds-163/ps/print.c
|
||||
uint32_t buffSize = sizeof buff;
|
||||
if (_NSGetExecutablePath(buff, &buffSize) == 0) return std::string(buff);
|
||||
#elif defined(__BSD__)
|
||||
#elif defined(__BSD__) && defined(KERN_PROC_PATHNAME)
|
||||
// BSDs do not have /proc by default, (although it can be mounted as procfs via the Linux
|
||||
// compatibility layer). We can use sysctl instead: per sysctl(3), passing in a process ID of -1
|
||||
// returns the value for the current process.
|
||||
|
||||
Reference in New Issue
Block a user