aboutsummaryrefslogtreecommitdiffhomepage
path: root/helper
diff options
context:
space:
mode:
Diffstat (limited to 'helper')
-rw-r--r--helper/bwrap/config_test.go4
-rw-r--r--helper/proc/self.go26
-rw-r--r--helper/seccomp/export_test.go4
-rw-r--r--helper/stub.go4
4 files changed, 6 insertions, 32 deletions
diff --git a/helper/bwrap/config_test.go b/helper/bwrap/config_test.go
index ca6e9636..d48f4f4c 100644
--- a/helper/bwrap/config_test.go
+++ b/helper/bwrap/config_test.go
@@ -1,6 +1,7 @@
package bwrap_test
import (
+ "log"
"os"
"slices"
"testing"
@@ -8,11 +9,10 @@ import (
"git.gensokyo.uk/security/fortify/helper/bwrap"
"git.gensokyo.uk/security/fortify/helper/proc"
"git.gensokyo.uk/security/fortify/helper/seccomp"
- "git.gensokyo.uk/security/fortify/internal/fmsg"
)
func TestConfig_Args(t *testing.T) {
- seccomp.CPrintln = fmsg.Println
+ seccomp.CPrintln = log.Println
t.Cleanup(func() { seccomp.CPrintln = nil })
testCases := []struct {
diff --git a/helper/proc/self.go b/helper/proc/self.go
deleted file mode 100644
index 6dc92eb7..00000000
--- a/helper/proc/self.go
+++ /dev/null
@@ -1,26 +0,0 @@
-package proc
-
-import (
- "os"
- "sync"
-
- "git.gensokyo.uk/security/fortify/internal/fmsg"
-)
-
-var (
- executable string
- executableOnce sync.Once
-)
-
-func copyExecutable() {
- if name, err := os.Executable(); err != nil {
- fmsg.Fatalf("cannot read executable path: %v", err)
- } else {
- executable = name
- }
-}
-
-func MustExecutable() string {
- executableOnce.Do(copyExecutable)
- return executable
-}
diff --git a/helper/seccomp/export_test.go b/helper/seccomp/export_test.go
index 8e21fe1f..40f81c7a 100644
--- a/helper/seccomp/export_test.go
+++ b/helper/seccomp/export_test.go
@@ -4,12 +4,12 @@ import (
"crypto/sha512"
"errors"
"io"
+ "log"
"slices"
"syscall"
"testing"
"git.gensokyo.uk/security/fortify/helper/seccomp"
- "git.gensokyo.uk/security/fortify/internal/fmsg"
)
func TestExport(t *testing.T) {
@@ -79,7 +79,7 @@ func TestExport(t *testing.T) {
buf := make([]byte, 8)
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
- seccomp.CPrintln = fmsg.Println
+ seccomp.CPrintln = log.Println
t.Cleanup(func() { seccomp.CPrintln = nil })
e := seccomp.New(tc.opts)
diff --git a/helper/stub.go b/helper/stub.go
index 58913022..12daa9fd 100644
--- a/helper/stub.go
+++ b/helper/stub.go
@@ -14,7 +14,7 @@ import (
"git.gensokyo.uk/security/fortify/helper/bwrap"
"git.gensokyo.uk/security/fortify/helper/proc"
- "git.gensokyo.uk/security/fortify/internal/fmsg"
+ "git.gensokyo.uk/security/fortify/internal"
)
// InternalChildStub is an internal function but exported because it is cross-package;
@@ -40,7 +40,7 @@ func InternalChildStub() {
genericStub(flagRestoreFiles(4, ap, sp))
}
- fmsg.Exit(0)
+ internal.Exit(0)
}
// InternalReplaceExecCommand is an internal function but exported because it is cross-package;