diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-02-26 17:19:36 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-02-26 17:19:36 +0900 |
| commit | 741d011543756850397ab7453cc13c9f5210e2b5 (patch) | |
| tree | 939e1f0f634d8053c6731b8a38f1477863afd1f2 | |
| parent | d050b3de259c6ab1ebbee75eff1940dbbc84ced9 (diff) | |
fortify: configure seccomp logger early
Signed-off-by: Ophestra <cat@gensokyo.uk>
| -rw-r--r-- | main.go | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -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) |
