Skip to content

Commit 31280a1

Browse files
committed
cgroup2: should add IN_CLOEXEC for inotify fd
REF: https://man7.org/linux/man-pages/man2/inotify_init.2.html Signed-off-by: Wei Fu <[email protected]>
1 parent 583d9a7 commit 31280a1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cgroup2/manager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ func (c *Manager) isCgroupEmpty() bool {
745745
// MemoryEventFD returns inotify file descriptor and 'memory.events' inotify watch descriptor
746746
func (c *Manager) MemoryEventFD() (int, uint32, error) {
747747
fpath := filepath.Join(c.path, "memory.events")
748-
fd, err := unix.InotifyInit()
748+
fd, err := unix.InotifyInit1(unix.IN_CLOEXEC)
749749
if err != nil {
750750
return 0, 0, fmt.Errorf("failed to create inotify fd: %w", err)
751751
}

0 commit comments

Comments
 (0)