- Timestamp:
- 2006-01-10T21:35:08Z (18 years ago)
- Branches:
- master
- Children:
- a4dc9f7
- Parents:
- 3e91c3e (diff), dd8d4c5 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
unix.c
r3e91c3e r8e419cb 32 32 #include <unistd.h> 33 33 #include <sys/time.h> 34 #include <sys/wait.h> 34 35 35 36 global_t global; /* Against global namespace pollution */ … … 46 47 global.loop = g_main_new( FALSE ); 47 48 48 log_init( 49 log_init(); 49 50 50 51 nogaim_init(); … … 76 77 log_message( LOGLVL_INFO, "Bitlbee %s starting in daemon mode.", BITLBEE_VERSION ); 77 78 } 79 else if( global.conf->runmode == RUNMODE_FORKDAEMON ) 80 { 81 i = bitlbee_daemon_init(); 82 log_message( LOGLVL_INFO, "Bitlbee %s starting in forking daemon mode.", BITLBEE_VERSION ); 83 } 78 84 if( i != 0 ) 79 85 return( i ); 80 86 81 global.storage = storage_init( global.conf->primary_storage, 82 global.conf->migrate_storage ); 87 global.storage = storage_init( global.conf->primary_storage, global.conf->migrate_storage ); 83 88 if ( global.storage == NULL) { 84 89 log_message( LOGLVL_ERROR, "Unable to load storage backend '%s'", global.conf->primary_storage ); … … 90 95 memset( &sig, 0, sizeof( sig ) ); 91 96 sig.sa_handler = sighandler; 97 sigaction( SIGCHLD, &sig, &old ); 92 98 sigaction( SIGPIPE, &sig, &old ); 93 99 sig.sa_flags = SA_RESETHAND; … … 113 119 static void sighandler( int signal ) 114 120 { 115 /* FIXME: In fact, calling log_message() here can be dangerous. But well, let's take the risk for now.*/121 /* FIXME: Calling log_message() here is not a very good idea! */ 116 122 117 123 if( signal == SIGTERM ) … … 139 145 } 140 146 } 147 else if( signal == SIGCHLD ) 148 { 149 pid_t pid; 150 int st; 151 152 while( ( pid = waitpid( 0, &st, WNOHANG ) ) > 0 ) 153 { 154 if( WIFSIGNALED( st ) ) 155 log_message( LOGLVL_INFO, "Client %d terminated normally. (status = %d)", pid, WEXITSTATUS( st ) ); 156 else if( WIFEXITED( st ) ) 157 log_message( LOGLVL_INFO, "Client %d killed by signal %d.", pid, WTERMSIG( st ) ); 158 } 159 } 141 160 else if( signal != SIGPIPE ) 142 161 {
Note: See TracChangeset
for help on using the changeset viewer.