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>
This commit is contained in:
2025-01-18 11:59:33 +09:00
parent 27d2914286
commit 7baca66a56
7 changed files with 36 additions and 15 deletions

26
internal/proc/self.go Normal file
View File

@@ -0,0 +1,26 @@
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
}