os: fix executable on FreeBSD and older C compilers
parent
01531369f7
commit
43fb954234
|
@ -692,9 +692,9 @@ pub fn executable() string {
|
|||
}
|
||||
$if freebsd {
|
||||
mut result := malloc(MAX_PATH)
|
||||
mut mib := [1 /* CTL_KERN */, 14 /* KERN_PROC */, 12 /* KERN_PROC_PATHNAME */, -1]!!
|
||||
mib := [1 /* CTL_KERN */, 14 /* KERN_PROC */, 12 /* KERN_PROC_PATHNAME */, -1]
|
||||
size := MAX_PATH
|
||||
C.sysctl(mib, 4, result, &size, 0, 0)
|
||||
C.sysctl(mib.data, 4, result, &size, 0, 0)
|
||||
return string(result)
|
||||
}
|
||||
$if openbsd {
|
||||
|
|
Loading…
Reference in New Issue