--- rxvt-unicode/src/logging.C 2006/01/17 09:31:24 1.26 +++ rxvt-unicode/src/logging.C 2006/01/17 11:02:10 1.30 @@ -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 @@ -33,9 +33,9 @@ #include "../config.h" #include "rxvt.h" -#include "logging.h" +#include "ptytty.h" -#ifdef UTMP_SUPPORT +#if UTMP_SUPPORT #if HAVE_STRUCT_UTMP static int rxvt_write_bsd_utmp (int utmp_pos, struct utmp *wu); @@ -57,8 +57,13 @@ * make and write utmp and wtmp entries */ void -rxvt_session::login (const char *pty, 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; + + if (!pty || !*pty) + return; + this->cmd_pid = cmd_pid; this->login_shell = login_shell; @@ -222,8 +227,11 @@ * remove utmp and wtmp entries */ void -rxvt_session::logout () +rxvt_ptytty_unix::logout () { + if (!cmd_pid) + return; + #ifdef HAVE_STRUCT_UTMP struct utmp *tmput, *ut = &this->ut; #endif @@ -303,6 +311,8 @@ pututxline (utx); endutxent (); #endif + + cmd_pid = 0; } /* ------------------------------------------------------------------------- */