Re: [gtk-list] Re: Proper way to fork() a GTK program (to exec() something)
- From: Drazen Kacar <dave srce hr>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: Proper way to fork() a GTK program (to exec() something)
- Date: Tue, 9 Mar 1999 12:56:21 +0100
Eric wrote:
> This poses a little problem: What if a GTK application wants to execute
> a program and, say, give the user some buttons to kill the program using
> various signals? That program very well might be using exit(), and thus
> screw up your application.
There are several solutions for that. After fork(), but before exec()
in child, you can close all file descriptors except the first three (if
you need them), and that should do the trick. Get the current soft limit
of file descriptors with getrlimit() and close everything. It is
expensive, but this is how some other programs solve that task. Threaded
web servers when executing CGI program, for example.
You could also override exit() with LD_PRELOAD on platforms which support
that, but I think this is an overkill.
--
.-. .-. Life is a sexually transmitted disease.
(_ \ / _)
| dave@srce.hr
| dave@fly.cc.fer.hr
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]