--- rxvt-unicode/src/logging.C 2006/01/17 10:19:13 1.28 +++ rxvt-unicode/src/logging.C 2006/01/18 08:40:44 1.32 @@ -14,7 +14,7 @@ * - extensive modifications * Copyright (c) 1999 D J Hawkey Jr * - lastlog support - * Copyright (c) 2004 Marc Lehmann + * Copyright (c) 2004-2006 Marc Lehmann * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -57,7 +57,7 @@ * make and write utmp and wtmp entries */ void -rxvt_ptytty::login (int cmd_pid, bool login_shell, const char *hostname) +rxvt_ptytty_unix::login (int cmd_pid, bool login_shell, const char *hostname) { const char *pty = name; @@ -165,14 +165,19 @@ #endif #if defined(HAVE_STRUCT_UTMP) && !defined(HAVE_UTMP_PID) - { # ifdef HAVE_TTYSLOT + int fdstdin = dup (STDIN_FILENO); + dup2 (pty->tty, STDIN_FILENO); + i = ttyslot (); if (rxvt_write_bsd_utmp (i, ut)) utmp_pos = i; + + dup2 (fdstdin, STDIN_FILENO); + close (fdstdin); # else - FILE *fd0; + FILE *fd0; if ((fd0 = fopen (TTYTAB_FILENAME, "r")) != NULL) { @@ -200,9 +205,7 @@ #endif #ifdef WTMP_SUPPORT -# ifdef WTMP_ONLY_ON_LOGIN if (login_shell) -# endif { # ifdef HAVE_STRUCT_UTMP # ifdef HAVE_UPDWTMP @@ -227,7 +230,7 @@ * remove utmp and wtmp entries */ void -rxvt_ptytty::logout () +rxvt_ptytty_unix::logout () { if (!cmd_pid) return; @@ -276,9 +279,7 @@ * Write ending wtmp entry */ #ifdef WTMP_SUPPORT -# ifdef WTMP_ONLY_ON_LOGIN if (login_shell) -# endif { # ifdef HAVE_STRUCT_UTMP # ifdef HAVE_UPDWTMP