… | |
… | |
1607 | if (pty->pty >= 0) |
1607 | if (pty->pty >= 0) |
1608 | { |
1608 | { |
1609 | if (getfd_hook) |
1609 | if (getfd_hook) |
1610 | pty->pty = (*getfd_hook) (pty->pty); |
1610 | pty->pty = (*getfd_hook) (pty->pty); |
1611 | |
1611 | |
1612 | if (pty->pty < 0 || fcntl (pty->pty, F_SETFL, O_NONBLOCK)) |
1612 | if (pty->pty < 0) |
1613 | rxvt_fatal ("unusable pty-fd filehandle, aborting.\n"); |
1613 | rxvt_fatal ("unusable pty-fd filehandle, aborting.\n"); |
1614 | } |
1614 | } |
1615 | } |
1615 | } |
1616 | else |
1616 | else |
1617 | #endif |
1617 | #endif |
1618 | if (!pty->get ()) |
1618 | if (!pty->get ()) |
1619 | rxvt_fatal ("can't initialize pseudo-tty, aborting.\n"); |
1619 | rxvt_fatal ("can't initialize pseudo-tty, aborting.\n"); |
|
|
1620 | |
|
|
1621 | fcntl (pty->pty, F_SETFL, O_NONBLOCK); |
1620 | |
1622 | |
1621 | struct termios tio = def_tio; |
1623 | struct termios tio = def_tio; |
1622 | |
1624 | |
1623 | #ifndef NO_BACKSPACE_KEY |
1625 | #ifndef NO_BACKSPACE_KEY |
1624 | if (rs[Rs_backspace_key][0] && !rs[Rs_backspace_key][1]) |
1626 | if (rs[Rs_backspace_key][0] && !rs[Rs_backspace_key][1]) |
… | |
… | |
1674 | |
1676 | |
1675 | _exit (EXIT_FAILURE); |
1677 | _exit (EXIT_FAILURE); |
1676 | |
1678 | |
1677 | default: |
1679 | default: |
1678 | if (!option (Opt_utmpInhibit)) |
1680 | if (!option (Opt_utmpInhibit)) |
|
|
1681 | { |
|
|
1682 | #ifdef LOG_ONLY_ON_LOGIN |
|
|
1683 | bool login_shell = option (Opt_loginShell); |
|
|
1684 | #else |
|
|
1685 | bool login_shell = true; |
|
|
1686 | #endif |
1679 | pty->login (cmd_pid, option (Opt_loginShell), rs[Rs_display_name]); |
1687 | pty->login (cmd_pid, login_shell, rs[Rs_display_name]); |
|
|
1688 | } |
1680 | |
1689 | |
1681 | pty->close_tty (); |
1690 | pty->close_tty (); |
1682 | |
1691 | |
1683 | child_ev.start (cmd_pid); |
1692 | child_ev.start (cmd_pid); |
1684 | |
1693 | |
… | |
… | |
1709 | #elif defined (SRIOCSREDIR) |
1718 | #elif defined (SRIOCSREDIR) |
1710 | int fd; |
1719 | int fd; |
1711 | |
1720 | |
1712 | fd = open (CONSOLE, O_WRONLY, 0); |
1721 | fd = open (CONSOLE, O_WRONLY, 0); |
1713 | if (fd >= 0) |
1722 | if (fd >= 0) |
|
|
1723 | { |
1714 | if (ioctl (fd, SRIOCSREDIR, NULL) < 0) |
1724 | ioctl (fd, SRIOCSREDIR, NULL); |
1715 | close (fd); |
1725 | close (fd); |
|
|
1726 | } |
1716 | #endif /* SRIOCSREDIR */ |
1727 | #endif /* SRIOCSREDIR */ |
1717 | } |
1728 | } |
1718 | |
1729 | |
1719 | /* reset signals and spin off the command interpreter */ |
1730 | /* reset signals and spin off the command interpreter */ |
1720 | signal (SIGINT, SIG_DFL); |
1731 | signal (SIGINT, SIG_DFL); |