Skip to content

Commit

Permalink
inotify: Avoid leaking file descriptor to child processes
Browse files Browse the repository at this point in the history
inotify_init creates a file descriptor which by default is not makes
with CLOEXEC. If the application using libusbmuxd spawns applications
this then leaks through.
  • Loading branch information
davidedmundson authored and nikias committed Mar 27, 2024
1 parent 3d9f5df commit c8e6270
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libusbmuxd.c
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,7 @@ static int usbmuxd_listen_inotify()
return sfd;

sfd = -1;
inot_fd = inotify_init ();
inot_fd = inotify_init1(IN_CLOEXEC);
if (inot_fd < 0) {
LIBUSBMUXD_DEBUG(1, "%s: Failed to setup inotify\n", __func__);
return -2;
Expand Down

0 comments on commit c8e6270

Please sign in to comment.