aboutsummaryrefslogtreecommitdiffhomepage
path: root/helper/seccomp/export.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-02-23 03:24:37 +0900
committerOphestra <cat@gensokyo.uk>2025-02-23 03:24:37 +0900
commiteda4d612c2e64321766e1074a698caeae843102a (patch)
treec492042ffd52930c8578884ec2800a25690bae3a /helper/seccomp/export.go
parent2e7e16068372a0c0b42bd6b3da2433134c91a495 (diff)
fortify: keep external files alive
This should eliminate sporadic failures, like the known double close in "seccomp". Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'helper/seccomp/export.go')
-rw-r--r--helper/seccomp/export.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/helper/seccomp/export.go b/helper/seccomp/export.go
index 52ec4144..9efee3b4 100644
--- a/helper/seccomp/export.go
+++ b/helper/seccomp/export.go
@@ -27,7 +27,12 @@ func (e *exporter) prepare() error {
}
ec := make(chan error, 1)
- go func(fd uintptr) { ec <- exportFilter(fd, e.opts); close(ec); _ = e.closeWrite() }(e.w.Fd())
+ go func(fd uintptr) {
+ ec <- exportFilter(fd, e.opts)
+ close(ec)
+ _ = e.closeWrite()
+ runtime.KeepAlive(e.w)
+ }(e.w.Fd())
e.exportErr = ec
runtime.SetFinalizer(e, (*exporter).closeWrite)
})