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>
This commit is contained in:
parent
29c38caac8
commit
468696f611
@ -4,6 +4,8 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"git.gensokyo.uk/security/fortify/internal/fmsg"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -13,6 +15,7 @@ var (
|
|||||||
|
|
||||||
func copyExecutable() {
|
func copyExecutable() {
|
||||||
if name, err := os.Executable(); err != nil {
|
if name, err := os.Executable(); err != nil {
|
||||||
|
fmsg.BeforeExit()
|
||||||
log.Fatalf("cannot read executable path: %v", err)
|
log.Fatalf("cannot read executable path: %v", err)
|
||||||
} else {
|
} else {
|
||||||
executable = name
|
executable = name
|
||||||
|
@ -13,6 +13,7 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"git.gensokyo.uk/security/fortify/internal"
|
"git.gensokyo.uk/security/fortify/internal"
|
||||||
|
"git.gensokyo.uk/security/fortify/internal/fmsg"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Std implements System using the standard library.
|
// Std implements System using the standard library.
|
||||||
@ -73,6 +74,7 @@ func (s *Std) Uid(aid int) (int, error) {
|
|||||||
|
|
||||||
u.uid = -1
|
u.uid = -1
|
||||||
if fsu, ok := internal.Check(internal.Fsu); !ok {
|
if fsu, ok := internal.Check(internal.Fsu); !ok {
|
||||||
|
fmsg.BeforeExit()
|
||||||
log.Fatal("invalid fsu path, this copy of fortify is not compiled correctly")
|
log.Fatal("invalid fsu path, this copy of fortify is not compiled correctly")
|
||||||
// unreachable
|
// unreachable
|
||||||
return 0, syscall.EBADE
|
return 0, syscall.EBADE
|
||||||
|
Loading…
Reference in New Issue
Block a user