Changeset 0b510af


Ignore:
Timestamp:
2010-03-16T10:45:26Z (9 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
a1ac227
Parents:
ec55a7d
Message:

Check the RESTART environment variable before closing fd's 0-2 since the
previous approach broke upgrades to bzr >= 500.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • bitlbee.c

    rec55a7d r0b510af  
    109109                chdir( "/" );
    110110               
    111                 i = close( 0 ) == 0;
    112                 i += close( 1 ) == 0;
    113                 i += close( 2 ) == 0;
    114                 /* To avoid that something important ends up on one of those
    115                    fd's, open them for something bogus. Otherwise RESTART
    116                    may cause troubles. */
    117                 while( i > 0 )
    118                 {
    119                         open( "/dev/null", O_WRONLY );
    120                         i --;
    121                 }
     111                if( getenv( "_BITLBEE_RESTART_STATE" ) == NULL )
     112                        for( i = 0; i < 3; i ++ )
     113                                if( close( i ) == 0 )
     114                                {
     115                                        /* Keep something bogus on those fd's just in case. */
     116                                        open( "/dev/null", O_WRONLY );
     117                                }
    122118        }
    123119#endif
Note: See TracChangeset for help on using the changeset viewer.