fortify/internal/proc/self.go
Ophestra 7baca66a56
All checks were successful
Build / Create distribution (push) Successful in 1m46s
Test / Run NixOS test (push) Successful in 3m44s
proc: remove duplicate compile-time fortify reference
This is no longer needed since shim and init are now part of the main program.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-01-18 11:59:33 +09:00

27 lines
397 B
Go

package proc
import (
"os"
"sync"
"git.gensokyo.uk/security/fortify/internal/fmsg"
)
var (
executable string
executableOnce sync.Once
)
func copyExecutable() {
if name, err := os.Executable(); err != nil {
fmsg.Fatalf("cannot read executable path: %v", err)
} else {
executable = name
}
}
func MustExecutable() string {
executableOnce.Do(copyExecutable)
return executable
}