aboutsummaryrefslogtreecommitdiffstats
path: root/bitlbee.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2010-03-17 15:15:19 +0000
committerWilmer van der Gaast <wilmer@gaast.net>2010-03-17 15:15:19 +0000
commite8c8d00ea43c204ee276bde7fb663a0f0249790f (patch)
treea98fdef3c5885eb2eac2ba047e244b3fd3c0f800 /bitlbee.c
parent1c3008ac0b2b29f7e14ec9b874af3277c511c7a4 (diff)
parentf9928cb319c2879a56b7280f09723b26035982d0 (diff)
Merging mainline.
Diffstat (limited to 'bitlbee.c')
-rw-r--r--bitlbee.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/bitlbee.c b/bitlbee.c
index b31c31fe..26d12b6c 100644
--- a/bitlbee.c
+++ b/bitlbee.c
@@ -108,11 +108,13 @@ int bitlbee_daemon_init()
chdir( "/" );
- /* Sometimes std* are already closed (for example when we're in a RESTARTed
- BitlBee process. So let's only close TTY-fds. */
- if( isatty( 0 ) ) close( 0 );
- if( isatty( 1 ) ) close( 1 );
- if( isatty( 2 ) ) close( 2 );
+ if( getenv( "_BITLBEE_RESTART_STATE" ) == NULL )
+ for( i = 0; i < 3; i ++ )
+ if( close( i ) == 0 )
+ {
+ /* Keep something bogus on those fd's just in case. */
+ open( "/dev/null", O_WRONLY );
+ }
}
#endif