{
pty.pty = atoi (rs[Rs_pty_fd]);
- if (getfd_hook)
- pty.pty = (*getfd_hook) (pty.pty);
+ if (pty.pty >= 0)
+ {
+ if (getfd_hook)
+ pty.pty = (*getfd_hook) (pty.pty);
- if (pty.pty < 0 || fcntl (pty.pty, F_SETFL, O_NONBLOCK))
- rxvt_fatal ("unusable pty-fd filehandle, aborting.\n");
+ if (pty.pty < 0 || fcntl (pty.pty, F_SETFL, O_NONBLOCK))
+ rxvt_fatal ("unusable pty-fd filehandle, aborting.\n");
+ }
}
else
#endif
free (cmd_argv);
- pty_ev.start (pty.pty, EVENT_READ);
+ if (pty.pty >= 0)
+ pty_ev.start (pty.pty, EVENT_READ);
check_ev.start ();
rxvt_ptytty::close_tty ()
{
- if (tty >= 0) close (tty);
+ if (tty < 0)
+ return;
+
+ close (tty);
tty = -1;
}
rxvt_ptytty::set_utf8_mode (bool on)
{
#ifdef IUTF8
- if (pty != -1)
+ if (pty < 0)
+ return;
+
+ struct termios tio;
+
+ if (tcgetattr (pty, &tio) != -1)
{
- struct termios tio;
+ tcflag_t new_cflag = tio.c_iflag;
+
+ if (on)
+ new_cflag |= IUTF8;
+ else
+ new_cflag &= ~IUTF8;
- if (tcgetattr (pty, &tio) != -1)
+ if (new_cflag != tio.c_iflag)
{
- tcflag_t new_cflag = tio.c_iflag;
-
- if (on)
- new_cflag |= IUTF8;
- else
- new_cflag &= ~IUTF8;
-
- if (new_cflag != tio.c_iflag)
- {
- tio.c_iflag = new_cflag;
- tcsetattr (pty, TCSANOW, &tio);
- }
+ tio.c_iflag = new_cflag;
+ tcsetattr (pty, TCSANOW, &tio);
}
}
#endif
#ifdef USE_XIM
if (!XFilterEvent (&xev, None))
{
-
if (xev.type == PropertyNotify
&& xev.xany.window == root
&& xev.xproperty.atom == xa_xim_servers)