Rene W. Olsen wrote:
Hello,
I have been doing some coding on SANE now that my Python project was mindless...
I have almost got all the MainFunction compiled there is just two files that dont work... the first is a file with SCSI support commands in it, I have just skip it as I have no SCSI to test it with.
The second is Thread support and a more serious problem. They have been so nice to make two versions one with fork() and one with PThread.. When I try to compile the file it complains about some sigaction structure/function. (see below)
static void restore_sigpipe( void ) { struct sigaction act;
if( sigaction( SIGPIPE, NULL, &act ) == 0 ) { if( act.sa_handler == SIG_IGN ) { sigemptyset( &act.sa_mask ); act.sa_flags = 0; act.sa_handler = SIG_DFL; DBG( 2, "restoring SIGPIPE to SIG_DFL\n" ); sigaction( SIGPIPE, &act, NULL ); } }
}
In this code its first definded sigaction as a structure and then call it as a function ?! Its not the only place where they do that trick.
Uhm, they obviously have some code that needs to run with sigpipe ignored, and most code runs with sigpipe handled. sigaction is a function used to change or examine the settings of the signal handler for a specific signal. In this case you might get away with a global variable instead, and just do:
if(global_sigpipe_status_variable == SIG_IGN) { global_sigpipe_status_variable == SIG_DFL; signal(SIG_PIPE,global_sigpipe_status_variable); }
Or something.