Skip to content

Commit 2b95ef0

Browse files
Merge pull request #210 from cpuguy83/open_cloexec
Fix potential dirfd leak.
2 parents 9ada639 + 17fece8 commit 2b95ef0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

v2/manager.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ func setDevices(path string, devices []specs.LinuxDeviceCgroup) error {
658658
if err != nil {
659659
return err
660660
}
661-
dirFD, err := unix.Open(path, unix.O_DIRECTORY|unix.O_RDONLY, 0600)
661+
dirFD, err := unix.Open(path, unix.O_DIRECTORY|unix.O_RDONLY|unix.O_CLOEXEC, 0600)
662662
if err != nil {
663663
return fmt.Errorf("cannot get dir FD for %s", path)
664664
}

0 commit comments

Comments
 (0)