Date: Sat, 20 Jul 2019 13:59:37 +0000 From: bugzilla-noreply@freebsd.org To: gnome@FreeBSD.org Subject: [Bug 236815] [patch] devel/glib20: loops over all possible file descriptors Message-ID: <bug-236815-6497-lGi8UrHqz7@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-236815-6497@https.bugs.freebsd.org/bugzilla/> References: <bug-236815-6497@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D236815 --- Comment #10 from Ting-Wei Lan <lantw44@gmail.com> --- Comment on attachment 205931 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D205931 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) > } >=20 > #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] =3D {CTL_KERN, KERN_PROC, KERN_PROC_FILEDESC, 0}; >+ size_t len =3D 0; >+ struct kinfo_file kif; >+ >+ mib[3] =3D (int)getpid(); >+ >+ if (sysctl(mib, nitems(mib), NULL, &len, NULL, 0) !=3D 0) >+ return FALSE; >+ >+ if ((bp =3D (char*) malloc(len)) =3D=3D 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. --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-236815-6497-lGi8UrHqz7>