aboutsummaryrefslogtreecommitdiffhomepage
path: root/fish_pager.c
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2005-10-12 20:36:38 +1000
committerGravatar axel <axel@liljencrantz.se>2005-10-12 20:36:38 +1000
commit4aa1b193c9e2a1d2694c63db2eb21bc5c2ea27b6 (patch)
tree20d11a9893b950aa66ef0fd63641ab51f22d8dea /fish_pager.c
parent4636b783a047dbaa5d75c09cfa22fd219924d12c (diff)
Try to dup stderr if fopen(ttyname) fails on init (Needed when using su)
darcs-hash:20051012103638-ac50b-5a114b1adaa83ef48dd5c4821138c1c7af660204.gz
Diffstat (limited to 'fish_pager.c')
-rw-r--r--fish_pager.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/fish_pager.c b/fish_pager.c
index 2c4066fb..50074dfa 100644
--- a/fish_pager.c
+++ b/fish_pager.c
@@ -848,15 +848,15 @@ static void init()
close(1);
if( open( ttyname(0), O_WRONLY ) != 1 )
{
- debug( 0, L"Could not set up file descriptors for pager" );
- exit( 1 );
-
+ if( dup2( 2, 1 ) == -1 )
+ {
+ debug( 0, L"Could not set up file descriptors for pager" );
+ exit( 1 );
+ }
}
out_file = fdopen( out, "w" );
sb_init( &out_buff );
-
-
env_universal_init( 0, 0, 0, 0);
input_common_init( &interrupt_handler );
@@ -922,9 +922,6 @@ static void init()
exit(1);
}
-
-// writembs( tparm( eat_char, ' ', c ) );
-
}
void destroy()