linux: wrap fsu lookup error
All checks were successful
Test / Create distribution (push) Successful in 35s
Test / Run NixOS test (push) Successful in 5m58s

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-02-18 17:36:58 +09:00
parent d0400f3c81
commit 2c9c7fee5b
6 changed files with 40 additions and 11 deletions

View File

@@ -5,6 +5,7 @@ import (
"fmt"
"io"
"log"
"os"
"slices"
"strconv"
"strings"
@@ -13,6 +14,7 @@ import (
"git.gensokyo.uk/security/fortify/dbus"
"git.gensokyo.uk/security/fortify/fst"
"git.gensokyo.uk/security/fortify/internal/fmsg"
"git.gensokyo.uk/security/fortify/internal/state"
)
@@ -24,7 +26,8 @@ func printShowSystem(output io.Writer, short bool) {
// get fid by querying uid of aid 0
if uid, err := sys.Uid(0); err != nil {
log.Fatalf("cannot obtain uid from fsu: %v", err)
fmsg.PrintBaseError(err, "cannot obtain uid from fsu:")
os.Exit(1)
} else {
info.User = (uid / 10000) - 100
}