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 <rodrigoca@microsoft.com>
This commit is contained in:
Rodrigo Campos
2023-08-01 16:30:05 +02:00
parent dbe8434359
commit 99340bb0bd
+4
View File
@@ -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