Changes in / [f5d1b31:913545e]
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
bitlbee.c
rf5d1b31 r913545e 118 118 119 119 if( global.conf->runmode == RUNMODE_FORKDAEMON ) 120 ipc_master_load_state( getenv( "_BITLBEE_RESTART_STATE" ));120 ipc_master_load_state(); 121 121 122 122 if( global.conf->runmode == RUNMODE_DAEMON || global.conf->runmode == RUNMODE_FORKDAEMON ) -
conf.c
rf5d1b31 r913545e 78 78 } 79 79 80 while( argc > 0 && ( opt = getopt( argc, argv, "i:p:P:nvIDFc:d:h u:" ) ) >= 0 )80 while( argc > 0 && ( opt = getopt( argc, argv, "i:p:P:nvIDFc:d:hR:u:" ) ) >= 0 ) 81 81 /* ^^^^ Just to make sure we skip this step from the REHASH handler. */ 82 82 { … … 145 145 " -h Show this help page.\n" ); 146 146 return NULL; 147 } 148 else if( opt == 'R' ) 149 { 150 /* We can't load the statefile yet (and should make very sure we do this 151 only once), so set the filename here and load the state information 152 when initializing ForkDaemon. (This option only makes sense in that 153 mode anyway!) */ 154 ipc_master_set_statefile( optarg ); 147 155 } 148 156 else if( opt == 'u' ) -
ipc.c
rf5d1b31 r913545e 33 33 34 34 GSList *child_list = NULL; 35 static char *statefile = NULL; 35 36 36 37 static void ipc_master_cmd_client( irc_t *data, char **cmd ) … … 62 63 } 63 64 64 static void ipc_master_cmd_deaf( irc_t *data, char **cmd )65 {66 if( global.conf->runmode == RUNMODE_DAEMON )67 {68 b_event_remove( global.listen_watch_source_id );69 close( global.listen_socket );70 71 global.listen_socket = global.listen_watch_source_id = -1;72 73 ipc_to_children_str( "OPERMSG :Closed listening socket, waiting "74 "for all users to disconnect." );75 }76 else77 {78 ipc_to_children_str( "OPERMSG :The DEAF command only works in "79 "normal daemon mode. Try DIE instead." );80 }81 }82 83 65 void ipc_master_cmd_rehash( irc_t *data, char **cmd ) 84 66 { … … 116 98 { "hello", 0, ipc_master_cmd_client, 0 }, 117 99 { "die", 0, ipc_master_cmd_die, 0 }, 118 { "deaf", 0, ipc_master_cmd_deaf, 0 },119 100 { "wallops", 1, NULL, IPC_CMD_TO_CHILDREN }, 120 101 { "wall", 1, NULL, IPC_CMD_TO_CHILDREN }, … … 501 482 } 502 483 484 void ipc_master_set_statefile( char *fn ) 485 { 486 statefile = g_strdup( fn ); 487 } 488 503 489 504 490 static gboolean new_ipc_client( gpointer data, gint serversock, b_input_condition cond ) … … 564 550 #endif 565 551 566 int ipc_master_load_state( char *statefile)552 int ipc_master_load_state() 567 553 { 568 554 struct bitlbee_child *child; … … 572 558 if( statefile == NULL ) 573 559 return 0; 574 575 560 fp = fopen( statefile, "r" ); 576 561 unlink( statefile ); /* Why do it later? :-) */ -
ipc.h
rf5d1b31 r913545e 58 58 59 59 char *ipc_master_save_state(); 60 int ipc_master_load_state( char *statefile ); 60 void ipc_master_set_statefile( char *fn ); 61 int ipc_master_load_state(); 61 62 int ipc_master_listen_socket(); 62 63 -
irc.c
rf5d1b31 r913545e 315 315 g_free( irc ); 316 316 317 if( global.conf->runmode == RUNMODE_INETD || 318 global.conf->runmode == RUNMODE_FORKDAEMON || 319 ( global.conf->runmode == RUNMODE_DAEMON && 320 global.listen_socket == -1 && 321 irc_connection_list == NULL ) ) 317 if( global.conf->runmode == RUNMODE_INETD || global.conf->runmode == RUNMODE_FORKDAEMON ) 322 318 b_main_quit(); 323 319 } -
irc_commands.c
rf5d1b31 r913545e 626 626 { "completions", 0, irc_cmd_completions, IRC_CMD_LOGGED_IN }, 627 627 { "die", 0, NULL, IRC_CMD_OPER_ONLY | IRC_CMD_TO_MASTER }, 628 { "deaf", 0, NULL, IRC_CMD_OPER_ONLY | IRC_CMD_TO_MASTER },629 628 { "wallops", 1, NULL, IRC_CMD_OPER_ONLY | IRC_CMD_TO_MASTER }, 630 629 { "wall", 1, NULL, IRC_CMD_OPER_ONLY | IRC_CMD_TO_MASTER }, -
protocols/msn/ns.c
rf5d1b31 r913545e 278 278 if( num_parts == 5 ) 279 279 { 280 int i, groupcount; 281 282 groupcount = atoi( cmd[4] ); 283 if( groupcount > 0 ) 284 { 285 /* valgrind says this is leaking memory, I'm guessing 286 that this happens during server redirects. */ 287 if( md->grouplist ) 288 { 289 for( i = 0; i < md->groupcount; i ++ ) 290 g_free( md->grouplist[i] ); 291 g_free( md->grouplist ); 292 } 293 294 md->groupcount = groupcount; 280 md->buddycount = atoi( cmd[3] ); 281 md->groupcount = atoi( cmd[4] ); 282 if( md->groupcount > 0 ) 295 283 md->grouplist = g_new0( char *, md->groupcount ); 296 } 297 298 md->buddycount = atoi( cmd[3] ); 284 299 285 if( !*cmd[3] || md->buddycount == 0 ) 300 286 msn_logged_in( ic ); … … 679 665 imcb_log( ic, "INBOX contains %s new messages, plus %s messages in other folders.", inbox, folders ); 680 666 } 681 682 g_free( inbox );683 g_free( folders );684 667 } 685 668 else if( g_strncasecmp( ct, "text/x-msmsgsemailnotification", 30 ) == 0 ) -
unix.c
rf5d1b31 r913545e 40 40 static void sighandler( int signal ); 41 41 42 int main( int argc, char *argv[] )42 int main( int argc, char *argv[], char **envp ) 43 43 { 44 44 int i = 0; … … 141 141 { 142 142 char *fn = ipc_master_save_state(); 143 char **args; 144 int n, i; 143 145 144 146 chdir( old_cwd ); 145 147 146 setenv( "_BITLBEE_RESTART_STATE", fn, 1 ); 147 g_free( fn ); 148 n = 0; 149 args = g_new0( char *, argc + 3 ); 150 args[n++] = argv[0]; 151 if( fn ) 152 { 153 args[n++] = "-R"; 154 args[n++] = fn; 155 } 156 for( i = 1; argv[i] && i < argc; i ++ ) 157 { 158 if( strcmp( argv[i], "-R" ) == 0 ) 159 i += 2; 160 161 args[n++] = argv[i]; 162 } 148 163 149 164 close( global.listen_socket ); 150 165 151 if( execv( argv[0], argv ) == -1 ) 152 /* Apparently the execve() failed, so let's just 153 jump back into our own/current main(). */ 154 /* Need more cleanup code to make this work. */ 155 return 1; /* main( argc, argv ); */ 166 execve( args[0], args, envp ); 156 167 } 157 168
Note: See TracChangeset
for help on using the changeset viewer.