aboutsummaryrefslogtreecommitdiffstats
path: root/bitlbee.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2010-03-14 23:15:05 +0000
committerWilmer van der Gaast <wilmer@gaast.net>2010-03-14 23:15:05 +0000
commit33304688895db5751f9ef087ff92b0a9dc284627 (patch)
tree7c81d000a40eeb0353e67030184b3324d87b6c07 /bitlbee.c
parent7c5affcabd08f23e36719afefe736f266b80912b (diff)
parent7e2b5934976f6d833397f72bd11fbc63616a56f2 (diff)
Merging in head.
Diffstat (limited to 'bitlbee.c')
-rw-r--r--bitlbee.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/bitlbee.c b/bitlbee.c
index 0feb88fc..9e040f59 100644
--- a/bitlbee.c
+++ b/bitlbee.c
@@ -108,11 +108,17 @@ 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 );
+ i = close( 0 ) == 0;
+ i += close( 1 ) == 0;
+ i += close( 2 ) == 0;
+ /* To avoid that something important ends up on one of those
+ fd's, open them for something bogus. Otherwise RESTART
+ may cause troubles. */
+ while( i > 0 )
+ {
+ open( "/dev/null", O_WRONLY );
+ i --;
+ }
}
#endif