aboutsummaryrefslogtreecommitdiffhomepage
path: root/main.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-01-01 21:34:57 +0900
committerOphestra <cat@gensokyo.uk>2025-01-01 21:34:57 +0900
commit6acd0d4e88af6a80836c5409023bbb6ebc57231f (patch)
treec0b5ab89cb7549e817c5dac9c0894279ac376275 /main.go
parent35b714231768d11b82e575701ca5c7a081e2c542 (diff)
linux/std: handle fsu exit status 1
Printing "exit status 1" is confusing. This handles the ExitError and returns EACCES instead. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'main.go')
-rw-r--r--main.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/main.go b/main.go
index 2449b681..e4f2860d 100644
--- a/main.go
+++ b/main.go
@@ -4,6 +4,7 @@ import (
_ "embed"
"flag"
"fmt"
+ "os"
"os/user"
"strconv"
"strings"
@@ -32,7 +33,7 @@ func init() {
flag.BoolVar(&flagJSON, "json", false, "Format output in JSON when applicable")
}
-var os = new(linux.Std)
+var sys linux.System = new(linux.Std)
type gl []string
@@ -64,7 +65,7 @@ func main() {
fmt.Println("Usage:\tfortify [-v] [--json] COMMAND [OPTIONS]")
fmt.Println()
fmt.Println("Commands:")
- w := tabwriter.NewWriter(os.Stdout(), 0, 1, 4, ' ', 0)
+ w := tabwriter.NewWriter(os.Stdout, 0, 1, 4, ' ', 0)
commands := [][2]string{
{"app", "Launch app defined by the specified config file"},
{"run", "Configure and start a permissive default sandbox"},
@@ -206,7 +207,7 @@ func main() {
passwdOnce sync.Once
passwdFunc = func() {
var us string
- if uid, err := os.Uid(aid); err != nil {
+ if uid, err := sys.Uid(aid); err != nil {
fmsg.Fatalf("cannot obtain uid from fsu: %v", err)
} else {
us = strconv.Itoa(uid)
@@ -287,7 +288,7 @@ func main() {
}
func runApp(config *fst.Config) {
- a, err := app.New(os)
+ a, err := app.New(sys)
if err != nil {
fmsg.Fatalf("cannot create app: %s\n", err)
} else if err = a.Seal(config); err != nil {