Changeset 8661caa for unix.c


Ignore:
Timestamp:
2008-08-04T14:45:24Z (16 years ago)
Author:
ulim <a.sporto+bee@…>
Branches:
master
Children:
87f525e
Parents:
4ac647d (diff), 718e05f (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.
Message:

merged in upstream r410.

Only conflict was the correction of jabber normalization which I had already done.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • unix.c

    r4ac647d r8661caa  
    4040static void sighandler( int signal );
    4141
    42 int main( int argc, char *argv[], char **envp )
     42int main( int argc, char *argv[] )
    4343{
    4444        int i = 0;
     
    6060        if( global.conf->runmode == RUNMODE_INETD )
    6161        {
     62                log_link( LOGLVL_ERROR, LOGOUTPUT_IRC );
     63                log_link( LOGLVL_WARNING, LOGOUTPUT_IRC );
     64       
    6265                i = bitlbee_inetd_init();
    6366                log_message( LOGLVL_INFO, "Bitlbee %s starting in inetd mode.", BITLBEE_VERSION );
     
    6669        else if( global.conf->runmode == RUNMODE_DAEMON )
    6770        {
     71                log_link( LOGLVL_ERROR, LOGOUTPUT_SYSLOG );
     72                log_link( LOGLVL_WARNING, LOGOUTPUT_SYSLOG );
     73
    6874                i = bitlbee_daemon_init();
    6975                log_message( LOGLVL_INFO, "Bitlbee %s starting in daemon mode.", BITLBEE_VERSION );
     
    135141        {
    136142                char *fn = ipc_master_save_state();
    137                 char **args;
    138                 int n, i;
    139143               
    140144                chdir( old_cwd );
    141145               
    142                 n = 0;
    143                 args = g_new0( char *, argc + 3 );
    144                 args[n++] = argv[0];
    145                 if( fn )
    146                 {
    147                         args[n++] = "-R";
    148                         args[n++] = fn;
    149                 }
    150                 for( i = 1; argv[i] && i < argc; i ++ )
    151                 {
    152                         if( strcmp( argv[i], "-R" ) == 0 )
    153                                 i += 2;
    154                        
    155                         args[n++] = argv[i];
    156                 }
     146                setenv( "_BITLBEE_RESTART_STATE", fn, 1 );
     147                g_free( fn );
    157148               
    158149                close( global.listen_socket );
    159150               
    160                 execve( args[0], args, envp );
     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 ); */
    161156        }
    162157       
     
    219214        return( (double) time->tv_sec + (double) time->tv_usec / 1000000 );
    220215}
     216
     217
Note: See TracChangeset for help on using the changeset viewer.