aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/proc/priv/init/early.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/proc/priv/init/early.go')
-rw-r--r--internal/proc/priv/init/early.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/internal/proc/priv/init/early.go b/internal/proc/priv/init/early.go
new file mode 100644
index 00000000..cc1c2f7e
--- /dev/null
+++ b/internal/proc/priv/init/early.go
@@ -0,0 +1,18 @@
+package init0
+
+import (
+ "os"
+ "path"
+
+ "git.gensokyo.uk/security/fortify/internal/fmsg"
+)
+
+// used by the parent process
+
+// TryArgv0 calls [Main] if argv0 indicates the process is started from a file named "init".
+func TryArgv0() {
+ if len(os.Args) > 0 && path.Base(os.Args[0]) == "init" {
+ Main()
+ fmsg.Exit(0)
+ }
+}