fortify: configure seccomp logger early
Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
parent
d050b3de25
commit
741d011543
12
main.go
12
main.go
@ -68,7 +68,13 @@ func buildCommand(out io.Writer) command.Command {
|
|||||||
flagVerbose bool
|
flagVerbose bool
|
||||||
flagJSON 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(&flagVerbose, "v", command.BoolFlag(false), "Print debug messages to the console").
|
||||||
Flag(&flagJSON, "json", command.BoolFlag(false), "Serialise output as JSON when applicable")
|
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)
|
syscall.SIGINT, syscall.SIGTERM)
|
||||||
defer stop() // unreachable
|
defer stop() // unreachable
|
||||||
|
|
||||||
if fmsg.Load() {
|
|
||||||
seccomp.CPrintln = log.Println
|
|
||||||
}
|
|
||||||
|
|
||||||
if sa, err := a.Seal(config); err != nil {
|
if sa, err := a.Seal(config); err != nil {
|
||||||
fmsg.PrintBaseError(err, "cannot seal app:")
|
fmsg.PrintBaseError(err, "cannot seal app:")
|
||||||
internal.Exit(1)
|
internal.Exit(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user