Catching SIGINT problem

Bruce Edge bedge@sattel.com
Mon Nov 27 14:08:00 GMT 2000


I can't seem to trap a Ctrl-C in my app.

I use the following code to trap all signals I'm interested in:

  sigemptyset( &SignalSet );
 
  for ( int s = _SIGMIN; s < _SIGMAX; s++ ) {
    if ( ( s != SIGFPE ) &&
         ( s != SIGKILL ) &&
         ( s != SIGSTOP ) &&
         ( s != SIGCONT ) &&
         ( s != SIGTERM ) ) {
      sigaddset( &SignalSet, s );
      if ( signal( s, lcbd_SigHandler ) == SIG_ERR ) {
        syslog( LOG_CRIT, "sigaddset failed, sig %d, %s", s, strerror( errno )
);
        exit(-1);
      }
    }
 
}                                                                             

And then use the following handler:

void lcbd_SigHandler( int signo ) {
  ReceivedSignal = 1<<signo;
  // [BRE] * test
  if ( signo != 14 )
    return;
}
 
When I issue a "kill -s SIGURG" from bash, it calls my handler OK.
When I try a "kill -s SIGINT" the app terminates.

Am I missing something here?

TIA, Bruce.

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com



More information about the Cygwin mailing list