aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-02-16 19:02:52 +0900
committerOphestra <cat@gensokyo.uk>2025-02-16 19:03:34 +0900
commit468696f611178598c8cc6b918f134e92e03e8c29 (patch)
tree7464e4bce4cf2ad16e19a12f97799eebdb9efab6
parent29c38caac8a7fb828d6eb6b421943d2cb19ffd26 (diff)
internal: beforeExit before reachable fatal calls
These are the only two calls to log.Fatal* reachable during suspended output. Call fmsg.BeforeExit here to catch that. Signed-off-by: Ophestra <cat@gensokyo.uk>
-rw-r--r--internal/executable.go3
-rw-r--r--internal/linux/std.go2
2 files changed, 5 insertions, 0 deletions
diff --git a/internal/executable.go b/internal/executable.go
index 86ffab96..381a09b5 100644
--- a/internal/executable.go
+++ b/internal/executable.go
@@ -4,6 +4,8 @@ import (
"log"
"os"
"sync"
+
+ "git.gensokyo.uk/security/fortify/internal/fmsg"
)
var (
@@ -13,6 +15,7 @@ var (
func copyExecutable() {
if name, err := os.Executable(); err != nil {
+ fmsg.BeforeExit()
log.Fatalf("cannot read executable path: %v", err)
} else {
executable = name
diff --git a/internal/linux/std.go b/internal/linux/std.go
index 4850cf94..fceba95f 100644
--- a/internal/linux/std.go
+++ b/internal/linux/std.go
@@ -13,6 +13,7 @@ import (
"syscall"
"git.gensokyo.uk/security/fortify/internal"
+ "git.gensokyo.uk/security/fortify/internal/fmsg"
)
// Std implements System using the standard library.
@@ -73,6 +74,7 @@ func (s *Std) Uid(aid int) (int, error) {
u.uid = -1
if fsu, ok := internal.Check(internal.Fsu); !ok {
+ fmsg.BeforeExit()
log.Fatal("invalid fsu path, this copy of fortify is not compiled correctly")
// unreachable
return 0, syscall.EBADE