helper/seccomp: improve error handling

This passes both errno and libseccomp return value.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-03-12 15:52:48 +09:00
parent be16970e77
commit 29c3f8becb
5 changed files with 142 additions and 50 deletions

View File

@@ -115,7 +115,7 @@ func TestExport(t *testing.T) {
t.Errorf("Read: error = %v", err)
return
}
if err := e.Close(); err == nil || err.Error() != "seccomp_export_bpf failed: operation canceled" {
if err := e.Close(); err == nil || !errors.Is(err, syscall.ECANCELED) || !errors.Is(err, syscall.EBADF) {
t.Errorf("Close: error = %v", err)
return
}