fdwalk

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

fdwalk

Gtk+ - Dev - General mailing list
Heyho,

I discovered you have a fdwalk implementation in glib/gspawn.c which is not exported as a usable symbol. Is there any reason for this? If not, I'd suggest exporting that symbol and maybe even another wrapper that takes a list of FDs to keep open instead of the callback pointer and closes all other ones. Closing all fds except some specific ones is a common pattern before exec()ing.

--Markus


--
Google Germany GmbH, Erika-Mann-Str. 33, 80636 München, Geschäftsführer: Paul Manicle, Halimah DeLaine Prado, Registergericht und -nummer: Hamburg, HRB 86891, Sitz der Gesellschaft: Hamburg
This e-mail is confidential. If you received this communication by mistake, please don't forward it to anyone else, please erase all copies and attachments, and please let me know that it has gone to the wrong person.

_______________________________________________
gtk-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-devel-list
Reply | Threaded
Open this post in threaded view
|

Re: fdwalk

Philip Withnall-2
On Fri, 2018-01-12 at 13:15 +0000, Markus Teich via gtk-devel-list
wrote:
> Heyho,
>
> I discovered you have a fdwalk implementation in glib/gspawn.c which
> is not exported as a usable symbol. Is there any reason for this? If
> not, I'd suggest exporting that symbol and maybe even another wrapper
> that takes a list of FDs to keep open instead of the callback pointer
> and closes all other ones. Closing all fds except some specific ones
> is a common pattern before exec()ing.

GLib provides higher-level subprocess handling functionality with
GSubprocess; the g_subprocess_launcher_take_fd() and
g_subprocess_launcher_set_child_setup() functions are relevant here.
I’m not sure there’s enough demand to expose an fdwalk() implementation
to everyone.

Philip
_______________________________________________
gtk-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-devel-list

signature.asc (849 bytes) Download Attachment