mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-23 18:52:09 +01:00
gmain: close pidfd when finalizing GChildWatchSource
A file-descriptor was created with the introduction of pidfd_getfd() but nothing is closing it when the source finalizes. The GChildWatchSource is the creator and consumer of this FD and therefore responsible for closing it on finalization. The pidfd leak was introduced in !2408. This fixes issues with Builder where anon_inode:[pidfd] exhaust the available FD limit for the process. Fixes #2708
This commit is contained in:
parent
0bbd63bf19
commit
13c62bc181
@ -5646,7 +5646,11 @@ g_child_watch_finalize (GSource *source)
|
|||||||
GChildWatchSource *child_watch_source = (GChildWatchSource *) source;
|
GChildWatchSource *child_watch_source = (GChildWatchSource *) source;
|
||||||
|
|
||||||
if (child_watch_source->using_pidfd)
|
if (child_watch_source->using_pidfd)
|
||||||
return;
|
{
|
||||||
|
if (child_watch_source->poll.fd >= 0)
|
||||||
|
close (child_watch_source->poll.fd);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
G_LOCK (unix_signal_lock);
|
G_LOCK (unix_signal_lock);
|
||||||
unix_child_watches = g_slist_remove (unix_child_watches, source);
|
unix_child_watches = g_slist_remove (unix_child_watches, source);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user