summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar David Edmundson2023-11-01 14:32:43 +0000
committerGravatar Nikias Bassen2024-03-27 02:12:30 +0100
commitc8e627016edd1440c8faf6f9b8f4092a83e01164 (patch)
treef5e625a60f99fdbde83d3a6375f6aa79064d2d76
parent3d9f5dffd952b8f327ad43fafaf88ec44a921b6d (diff)
downloadlibusbmuxd-c8e627016edd1440c8faf6f9b8f4092a83e01164.tar.gz
libusbmuxd-c8e627016edd1440c8faf6f9b8f4092a83e01164.tar.bz2
inotify: Avoid leaking file descriptor to child processes
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.
-rw-r--r--src/libusbmuxd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libusbmuxd.c b/src/libusbmuxd.c
index bdd184b..8647ee2 100644
--- a/src/libusbmuxd.c
+++ b/src/libusbmuxd.c
@@ -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;