repo: rxvt-unicode-sixel
action: commit
revision: 
path_from: 
revision_from: 3dfe713baac03f3a3bce01d32ef9d4e6354410f1:
path_to: 
revision_to: 
git.thebackupbox.net
rxvt-unicode-sixel
git clone git://git.thebackupbox.net/rxvt-unicode-sixel
commit 3dfe713baac03f3a3bce01d32ef9d4e6354410f1
Author: Marc Lehmann 
Date:   Tue Jan 17 10:19:13 2006 +0000

    *** empty log message ***

diff --git a/src/logging.C b/src/logging.C
index 4c0fd9aec68013dde03a70dfa26b765a2cae7e62..
index ..733884c015aa3643a6d2c6731e371d3889256f2f 100644
--- 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
index 2c9bdd1d56a08698802ce4b9fb5f194a4cc72806..
index ..9a488f2c0eafc18559b373a203672b049ffe36dc 100644
--- 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
index 6210230ef05e53699855eec0af3dbcde590861ab..
index ..0e27097cfd21831e688fc5254ee8d38bb81caa12 100644
--- 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-----