os: fix executable on FreeBSD and older C compilers

pull/1461/head
Alexander Medvednikov 2019-08-04 00:16:37 +02:00
parent 01531369f7
commit 43fb954234
1 changed files with 2 additions and 2 deletions

View File

@ -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 {