Changeset 634

Show
Ignore:
Timestamp:
09/04/06 08:53:24 (2 years ago)
Author:
common
Message:

nepenthes

  • Nepenthes.cpp signal handling, handle SIGCHLD & SIGPIPE, so we don't have to ignore them, even though we don't want to use them
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • nepenthes/trunk/nepenthes-core/src/Nepenthes.cpp

    r632 r634  
    14211421void SignalHandler(int32_t iSignal) 
    14221422{ 
    1423         printf("Got signal %i\n", iSignal); 
     1423        if ( g_Nepenthes != NULL ) 
     1424                logWarn("Got signal %i ('%s')\n", iSignal,strsignal(iSignal)); 
     1425 
    14241426        switch ( iSignal ) 
    14251427        { 
    14261428        case SIGHUP: 
    1427                 logCrit("Got SIGHUP\nRereading Config File!\n\n"); 
    1428                 g_Nepenthes->reloadConfig(); 
     1429                if ( g_Nepenthes != NULL ) 
     1430                { 
     1431                        logCrit("Got SIGHUP\nRereading Config File!\n\n"); 
     1432                        g_Nepenthes->reloadConfig(); 
     1433                } 
    14291434                break; 
    14301435 
    14311436        case SIGINT: 
    1432                 logCrit("Got SIGINT\nStopping NOW!\n\n"); 
    1433                 g_Nepenthes->stop(); 
     1437                if ( g_Nepenthes != NULL ) 
     1438                { 
     1439                        logCrit("Got SIGINT\nStopping NOW!\n\n"); 
     1440                        g_Nepenthes->stop(); 
     1441                } 
    14341442                break; 
    14351443 
    14361444        case SIGABRT: 
    1437                 logCrit("Unhandled Exception\n"); 
     1445                if ( g_Nepenthes != NULL ) 
     1446                        logCrit("Unhandled Exception\n"); 
    14381447                exit(-1); 
    14391448                break; 
     
    14501459                exit(-1); 
    14511460                break; 
     1461 
     1462        case SIGPIPE: 
     1463                break; 
     1464 
     1465        case SIGCHLD: 
     1466                break; 
     1467 
    14521468 
    14531469        default: 
     
    15121528//      signal(SIGUSR1,  SignalHandler);        //   30,10,16    Term    User-defined signal 1 
    15131529//      signal(SIGUSR2,  SignalHandler);        //   31,12,17    Term    User-defined signal 2 
    1514 //    signal(SIGCHLD,  SignalHandler);        //   20,17,18    Ign     Child stopped or terminated 
     1530      signal(SIGCHLD,  SignalHandler);        //   20,17,18    Ign     Child stopped or terminated 
    15151531        signal(SIGCONT,  SignalHandler);        //   19,18,25            Continue if stopped 
    15161532//      signal(SIGSTOP,  SIG_IGN          );    //   17,19,23    Stop    Stop process