]> git.ipfire.org Git - thirdparty/bash.git/blobdiff - lib/readline/rltty.c
Bash-4.2 distribution sources and documentation
[thirdparty/bash.git] / lib / readline / rltty.c
index 0dd5d104a68383b21552fff3ed195d3e1af6c019..d237b1c00487dce38e5a49b4701e3f547ca03d93 100644 (file)
@@ -604,7 +604,7 @@ rl_prep_terminal (meta_flag)
   /* Try to keep this function from being INTerrupted. */
   _rl_block_sigint ();
 
-  tty = fileno (rl_instream);
+  tty = rl_instream ? fileno (rl_instream) : fileno (stdin);
 
   if (get_tty_settings (tty, &tio) < 0)
     {
@@ -678,7 +678,7 @@ rl_deprep_terminal ()
   /* Try to keep this function from being interrupted. */
   _rl_block_sigint ();
 
-  tty = fileno (rl_instream);
+  tty = rl_instream ? fileno (rl_instream) : fileno (stdout);
 
   if (_rl_enable_keypad)
     _rl_control_keypad (0);