aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmd/hsu
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-10-05 17:40:32 +0900
committerOphestra <cat@gensokyo.uk>2025-10-05 17:40:32 +0900
commitae7b343cde93bf59d2e3c7f6316d41c1474dd081 (patch)
tree5f07c90b493f38fe238c347ab2eb121d5350e81c /cmd/hsu
parenta63a372fe07a35fc355f54e72bbace47f157406c (diff)
hst: reword and move constants
These values are considered part of the stable, exported API, so move them to hst. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'cmd/hsu')
-rw-r--r--cmd/hsu/main.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/cmd/hsu/main.go b/cmd/hsu/main.go
index cb82c204..1f6ca7b6 100644
--- a/cmd/hsu/main.go
+++ b/cmd/hsu/main.go
@@ -1,5 +1,7 @@
package main
+// minimise imports to avoid inadvertently calling init or global variable functions
+
import (
"bytes"
"fmt"
@@ -19,6 +21,9 @@ const (
envGroups = "HAKUREI_GROUPS"
PR_SET_NO_NEW_PRIVS = 0x26
+
+ identityMin = 0
+ identityMax = 9999
)
func main() {
@@ -91,7 +96,7 @@ func main() {
// allowed identity range 0 to 9999
if as, ok := os.LookupEnv(envIdentity); !ok {
log.Fatal("HAKUREI_IDENTITY not set")
- } else if identity, err := parseUint32Fast(as); err != nil || identity < 0 || identity > 9999 {
+ } else if identity, err := parseUint32Fast(as); err != nil || identity < identityMin || identity > identityMax {
log.Fatal("invalid identity")
} else {
uid += identity