Skip to content

Commit 013176a

Browse files
committed
exepath: BSD: initial string length
1 parent bf81968 commit 013176a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/extra/exepath.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ std::string fs_exe_path()
6969
}
7070
#elif defined(BSD)
7171
// https://man.freebsd.org/cgi/man.cgi?sysctl(3)
72+
std::string path(fs_get_max_path(), '\0');
7273
std::size_t L = path.size();
7374
const int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
7475
if(sysctl(mib, 4, path.data(), &L, nullptr, 0) == 0) {

0 commit comments

Comments
 (0)