Skip to content

Commit c5fa089

Browse files
committed
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 <[email protected]>
1 parent dbe8434 commit c5fa089

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

contrib/cmd/fs-idmap/fs-idmap.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ func main() {
3131
if err := cmd.Start(); err != nil {
3232
log.Fatalf("failed to run the helper binary: %v", err)
3333
}
34+
defer cmd.Wait()
3435

3536
path := fmt.Sprintf("/proc/%d/ns/user", cmd.Process.Pid)
3637
var userNsFile *os.File
@@ -47,4 +48,6 @@ func main() {
4748
if err := unix.MountSetattr(treeFD, "", unix.AT_EMPTY_PATH|unix.AT_RECURSIVE, &attr); err != nil {
4849
log.Fatalf("error calling mount_setattr: %v", err)
4950
}
51+
52+
_ = cmd.Process.Kill()
5053
}

0 commit comments

Comments
 (0)