aboutsummaryrefslogtreecommitdiffhomepage
path: root/main.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-02-26 17:19:36 +0900
committerOphestra <cat@gensokyo.uk>2025-02-26 17:19:36 +0900
commit741d011543756850397ab7453cc13c9f5210e2b5 (patch)
tree939e1f0f634d8053c6731b8a38f1477863afd1f2 /main.go
parentd050b3de259c6ab1ebbee75eff1940dbbc84ced9 (diff)
fortify: configure seccomp logger early
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'main.go')
-rw-r--r--main.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/main.go b/main.go
index dc738e58..8df26592 100644
--- a/main.go
+++ b/main.go
@@ -68,7 +68,13 @@ func buildCommand(out io.Writer) command.Command {
flagVerbose bool
flagJSON bool
)
- c := command.New(out, log.Printf, "fortify", func([]string) error { fmsg.Store(flagVerbose); return nil }).
+ c := command.New(out, log.Printf, "fortify", func([]string) error {
+ fmsg.Store(flagVerbose)
+ if flagVerbose {
+ seccomp.CPrintln = log.Println
+ }
+ return nil
+ }).
Flag(&flagVerbose, "v", command.BoolFlag(false), "Print debug messages to the console").
Flag(&flagJSON, "json", command.BoolFlag(false), "Serialise output as JSON when applicable")
@@ -285,10 +291,6 @@ func runApp(a fst.App, config *fst.Config) {
syscall.SIGINT, syscall.SIGTERM)
defer stop() // unreachable
- if fmsg.Load() {
- seccomp.CPrintln = log.Println
- }
-
if sa, err := a.Seal(config); err != nil {
fmsg.PrintBaseError(err, "cannot seal app:")
internal.Exit(1)