From 99340bb0bd6cf2f3560ab5fb69eecf0b55b12a39 Mon Sep 17 00:00:00 2001 From: Rodrigo Campos Date: Tue, 1 Aug 2023 16:30:05 +0200 Subject: [PATCH] contrib/fs-idmap: Reap childs This is what we should do, although in practice this probably won't be a big issue as the parent also exits. While we are there, instead of waiting for the child to finish, kill it if we did everything we wanted to do. Signed-off-by: Rodrigo Campos --- contrib/cmd/fs-idmap/fs-idmap.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contrib/cmd/fs-idmap/fs-idmap.go b/contrib/cmd/fs-idmap/fs-idmap.go index b48114dfe..c060bc5a2 100644 --- a/contrib/cmd/fs-idmap/fs-idmap.go +++ b/contrib/cmd/fs-idmap/fs-idmap.go @@ -31,6 +31,10 @@ func main() { if err := cmd.Start(); err != nil { log.Fatalf("failed to run the helper binary: %v", err) } + defer func() { + _ = cmd.Process.Kill() + _ = cmd.Wait() + }() path := fmt.Sprintf("/proc/%d/ns/user", cmd.Process.Pid) var userNsFile *os.File