Re: XForms: How to detect fl_initialize in a spawned process?

Steve Lamont (spl@szechuan.ucsd.edu)
Wed, 13 Aug 97 20:53:09 PDT

To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

> I have a program which needs to be either spawned off the main program, or
> it can be run standalone. ...

How is the program spawned? With fork() and exec()? Although I
believe the file descriptor for the server connection is generally
marked "close on exec," it may not be in your version of Xlib -- you
might try the following:

#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>

[...]

if ( fork() == 0 ) {

int fd = ConnectionNumber( fl_get_display() );
int flag = fcntl( fd, F_GETFD, NULL );

if ( FD_CLOEXEC & flag )
close( fd );

execve( ...

What is the error message you are getting? This information is always
helpful.

spl
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/