Skip to content

Commit 17fece8

Browse files
committed
Fix potential dirfd leak.
Make sure we don't accidentally leak this dir fd by using O_CLOEXEC. Signed-off-by: Brian Goff <[email protected]>
1 parent 9ada639 commit 17fece8

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

v2/manager.go

Lines changed: 1 addition & 1 deletion
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)