diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-02-26 19:46:43 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-02-26 19:51:44 +0900 |
| commit | 673b648bd35285a1dbfc0348716dd6bdd8064a51 (patch) | |
| tree | 7fa388c20fb7509060964e0380f744bf9178a006 /internal/path.go | |
| parent | 45ad788c6d03bf368010fa8e2a39028bdf0fc078 (diff) | |
cmd/fpkg: call app in-process
Wrapping fortify is slow, painful and error-prone. Start apps in-process instead.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/path.go')
| -rw-r--r-- | internal/path.go | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/internal/path.go b/internal/path.go index 97b0754c..8211478b 100644 --- a/internal/path.go +++ b/internal/path.go @@ -1,12 +1,23 @@ package internal -import "path" +import ( + "log" + "path" + + "git.gensokyo.uk/security/fortify/internal/fmsg" +) var ( - Fsu = compPoison - Fortify = compPoison + fsu = compPoison ) -func Path(p string) (string, bool) { - return p, p != compPoison && p != "" && path.IsAbs(p) +func MustFsuPath() string { + if name, ok := checkPath(fsu); ok { + return name + } + fmsg.BeforeExit() + log.Fatal("invalid fsu path, this program is compiled incorrectly") + return compPoison } + +func checkPath(p string) (string, bool) { return p, p != compPoison && p != "" && path.IsAbs(p) } |
