repo: rxvt-unicode-sixel action: commit revision: path_from: revision_from: 3dfe713baac03f3a3bce01d32ef9d4e6354410f1: path_to: revision_to:
commit 3dfe713baac03f3a3bce01d32ef9d4e6354410f1 Author: Marc LehmannDate: Tue Jan 17 10:19:13 2006 +0000 *** empty log message *** diff --git a/src/logging.C b/src/logging.C
--- a/src/logging.C
+++ b/src/logging.C
@@ -59,11 +59,14 @@ static void rxvt_update_lastlog (const char *fname, con
void
rxvt_ptytty::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;
- const char *pty = name;
-
#ifdef HAVE_STRUCT_UTMP
struct utmp *ut = &this->ut;
#endif
@@ -226,6 +229,9 @@ rxvt_ptytty::login (int cmd_pid, bool login_shell, const char *hostname)
void
rxvt_ptytty::logout ()
{
+ if (!cmd_pid)
+ return;
+
#ifdef HAVE_STRUCT_UTMP
struct utmp *tmput, *ut = &this->ut;
#endif
@@ -305,6 +311,8 @@ rxvt_ptytty::logout ()
pututxline (utx);
endutxent ();
#endif
+
+ cmd_pid = 0;
}
/* ------------------------------------------------------------------------- */
diff --git a/src/main.C b/src/main.C
--- a/src/main.C
+++ b/src/main.C
@@ -719,8 +719,7 @@ rxvt_privileges (rxvt_privaction action)
void
rxvt_term::privileged_utmp (rxvt_privaction action)
{
- if (OPTION (Opt_utmpInhibit)
- || !pty.name || !*pty.name)
+ if (OPTION (Opt_utmpInhibit))
return;
rxvt_privileges (RESTORE);
diff --git a/src/ptytty.C b/src/ptytty.C
--- a/src/ptytty.C
+++ b/src/ptytty.C
@@ -374,10 +374,14 @@ rxvt_ptytty::rxvt_ptytty ()
#ifndef NO_SETOWNER_TTYDEV
saved = false;
#endif
+#if UTMP_SUPPORT
+ cmd_pid = 0;
+#endif
}
rxvt_ptytty::~rxvt_ptytty ()
{
+ logout ();
put ();
}
-----END OF PAGE-----