Skip to content

Commit e48b179

Browse files
authored
FileSystemWatcher.Unix: use CLOEXEC when initializing an inotify instance. (#64971)
This stops inotify instances from leaking into child processes, and helps reduce .NET applications hitting the system inotify limit.
1 parent e6a340d commit e48b179

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/native/libs/System.Native/pal_io.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1350,7 +1350,7 @@ int32_t SystemNative_CopyFile(intptr_t sourceFd, intptr_t destinationFd, int64_t
13501350
intptr_t SystemNative_INotifyInit(void)
13511351
{
13521352
#if HAVE_INOTIFY
1353-
return inotify_init();
1353+
return inotify_init1(IN_CLOEXEC);
13541354
#else
13551355
errno = ENOTSUP;
13561356
return -1;

0 commit comments

Comments
 (0)