Re: More info on GDK/GTK with fork() and exec()
- From: Paolo Molaro <lupus ximian com>
- To: GTK App Devel <gtk-app-devel-list gnome org>
- Subject: Re: More info on GDK/GTK with fork() and exec()
- Date: Wed, 20 Feb 2002 11:48:00 +0100
On 02/19/02 Taura Milana wrote:
The xscreensaver-demo apparently calls:
fork()
exec()
In that order, to execute a demo. This (on my side) causes GDK to
crash and loose connection to the X server and also crash the parent
process.
My suggestion and my own practice is to test if the object
existed before attempting to execute it, as follows:
if(!stat())
{
fork()
exec()
}
However Jamie stated that this was pointless, and that it was
okay to use fork() and exec() in GDK without testing the
validility of the object.
The stat is pointless as Jamie said already. However, there should
probably be a _exit(1) call after the exec, in case exec fails for
whatever reason (and note the underscore in _exit()). So the code should
look something like:
if (!fork()) {
exec (...);
/* maybe report error here to stderr */
_exit (1);
}
lupus
--
-----------------------------------------------------------------
lupus debian org debian/rules
lupus ximian com Monkeys do it better
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]