/* 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)
{
/* 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);