Try to dup stderr if fopen(ttyname) fails on init (Needed when using su)

darcs-hash:20051012103638-ac50b-5a114b1adaa83ef48dd5c4821138c1c7af660204.gz
This commit is contained in:
axel 2005-10-12 20:36:38 +10:00
parent 4636b783a0
commit 4aa1b193c9

View File

@ -848,15 +848,15 @@ static void init()
close(1); close(1);
if( open( ttyname(0), O_WRONLY ) != 1 ) if( open( ttyname(0), O_WRONLY ) != 1 )
{ {
debug( 0, L"Could not set up file descriptors for pager" ); if( dup2( 2, 1 ) == -1 )
exit( 1 ); {
debug( 0, L"Could not set up file descriptors for pager" );
exit( 1 );
}
} }
out_file = fdopen( out, "w" ); out_file = fdopen( out, "w" );
sb_init( &out_buff ); sb_init( &out_buff );
env_universal_init( 0, 0, 0, 0); env_universal_init( 0, 0, 0, 0);
input_common_init( &interrupt_handler ); input_common_init( &interrupt_handler );
@ -922,9 +922,6 @@ static void init()
exit(1); exit(1);
} }
// writembs( tparm( eat_char, ' ', c ) );
} }
void destroy() void destroy()