(trunk daemon) print a warning to stderr when tr_daemon() can't open /dev/null

This commit is contained in:
Charles Kerr 2010-02-19 05:25:58 +00:00
parent fea912dd21
commit 0ecee636d7
1 changed files with 2 additions and 0 deletions

View File

@ -172,6 +172,8 @@ tr_daemon( int nochdir, int noclose )
/* send stdin, stdout, and stderr to /dev/null */
int i;
int fd = open( "/dev/null", O_RDWR, 0 );
if( fd < 0 )
fprintf( stderr, "unable to open /dev/null: %s\n", tr_strerror(errno) );
for( i=0; i<3; ++i ) {
if( close( i ) )
return -1;