[Bug 236815] [patch] devel/glib20: loops over all possible file descriptors
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Sat Jul 20 13:59:38 UTC 2019
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=236815
--- Comment #10 from Ting-Wei Lan <lantw44 at gmail.com> ---
Comment on attachment 205931
--> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=205931
proposed fix
>--- glib/gspawn.c.orig 2018-09-21 12:29:23.000000000 +0300
>+++ glib/gspawn.c 2019-07-20 15:37:26.923958000 +0300
>@@ -1077,6 +1084,45 @@ set_cloexec (void *data, gint fd)
> }
>
> #ifndef HAVE_FDWALK
>+
>+#ifdef __FreeBSD__
>+static int
>+fdwalk_s(int (*cb)(void *data, int fd), void *data, gint *resp)
>+{
>+ char *bp, *ep;
>+ int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_FILEDESC, 0};
>+ size_t len = 0;
>+ struct kinfo_file kif;
>+
>+ mib[3] = (int)getpid();
>+
>+ if (sysctl(mib, nitems(mib), NULL, &len, NULL, 0) != 0)
>+ return FALSE;
>+
>+ if ((bp = (char*) malloc(len)) == NULL)
>+ return FALSE;
I am not sure if it is OK to use malloc here. The current fallback fdwalk
function says 'Avoid use of opendir/closedir since these are not
async-signal-safe'. Since malloc isn't async-signal-safe, using it may break
the expectation.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-gnome
mailing list