*** empty log message ***
authorayin <ayin>
Thu, 19 Jan 2006 16:37:54 +0000 (16:37 +0000)
committerayin <ayin>
Thu, 19 Jan 2006 16:37:54 +0000 (16:37 +0000)
src/feature.h
src/ptytty.C
src/ptytty.h

index f56fd4c..0d842cf 100644 (file)
 
 /*--------------------------------MISC----------------------------------*/
 /*
- * Disable to reset tty device to pre-incovation state
- */
-#define RESET_TTY_TO_COMMON_DEFAULTS
-
-/*
  * Only log in wtmp and lastlog files when we're a login shell (-ls option)
  */
 #define LOG_ONLY_ON_LOGIN
index 33ed72a..6040c43 100644 (file)
@@ -69,7 +69,8 @@
 static inline int
 get_pty_streams (int *fd_tty, char **ttydev)
 {
-#ifdef NO_SETOWNER_TTYDEV
+#if defined(HAVE_GRANTPT) && defined(HAVE_UNLOCKPT)
+# if defined(PTYS_ARE_GETPT) || defined(PTYS_ARE_POSIX) || defined(PTYS_ARE_PTMX)
   int pfd;
 
 # if defined(PTYS_ARE_GETPT)
@@ -90,6 +91,7 @@ get_pty_streams (int *fd_tty, char **ttydev)
 
       close (pfd);
     }
+# endif
 #endif
 
   return -1;
@@ -360,9 +362,6 @@ rxvt_ptytty::set_utf8_mode (bool on)
 #endif
 }
 
-/////////////////////////////////////////////////////////////////////////////
-
-#ifndef NO_SETOWNER_TTYDEV
 static struct ttyconf {
   gid_t gid;
   mode_t mode;
@@ -386,30 +385,6 @@ static struct ttyconf {
     }
 } ttyconf;
 
-/////////////////////////////////////////////////////////////////////////////
-
-void
-rxvt_ptytty_unix::privileges (rxvt_privaction action)
-{
-  if (!name || !*name)
-    return;
-
-  if (action == SAVE)
-    {
-      chown (name, getuid (), ttyconf.gid);      /* fail silently */
-      chmod (name, ttyconf.mode);
-# ifdef HAVE_REVOKE
-      revoke (name);
-# endif
-    }
-  else
-    {                    /* action == RESTORE */
-      chmod (name, RESTORE_TTY_MODE);
-      chown (name, 0, ttyconf.gid);
-    }
-}
-#endif
-
 rxvt_ptytty_unix::rxvt_ptytty_unix ()
 {
   pty = tty = -1;
@@ -430,9 +405,8 @@ rxvt_ptytty_unix::~rxvt_ptytty_unix ()
 void
 rxvt_ptytty_unix::put ()
 {
-#ifndef NO_SETOWNER_TTYDEV
-  privileges (RESTORE);
-#endif
+  chmod (name, RESTORE_TTY_MODE);
+  chown (name, 0, ttyconf.gid);
 
   if (pty >= 0) close (pty);
   close_tty ();
@@ -455,7 +429,11 @@ rxvt_ptytty_unix::get ()
   if (tty < 0)
     {
 #ifndef NO_SETOWNER_TTYDEV
-      privileges (SAVE);
+      chown (name, getuid (), ttyconf.gid);      /* fail silently */
+      chmod (name, ttyconf.mode);
+# ifdef HAVE_REVOKE
+      revoke (name);
+# endif
 #endif
 
       if ((tty = get_tty (name)) < 0)
index 3d0e3bb..b124e23 100644 (file)
@@ -9,12 +9,12 @@
 #  define NO_SETOWNER_TTYDEV 1
 # endif
 #endif
-#if defined(__CYGWIN__)
+#if defined(__CYGWIN__) || defined(PTYS_ARE_OPENPTY)
 # define NO_SETOWNER_TTYDEV 1
 #endif
 
 #if UTMP_SUPPORT
-# if !defined(RXVT_UTMPX_FILE) || !defined(HAVE_STRUCT_UTMPX)
+# if !defined(RXVT_UTMPX_FILE) || !defined(HAVE_STRUCT_UTMPX) || defined(__GLIBC__)
 #  undef HAVE_UTMPX_H
 #  undef HAVE_STRUCT_UTMPX
 # endif
@@ -55,13 +55,6 @@ struct rxvt_ptytty_unix : rxvt_ptytty
 {
   char *name;
 
-#ifndef RESET_TTY_TO_COMMON_DEFAULTS
-  struct stat savestat; /* original status of our tty */
-#endif
-#ifndef NO_SETOWNER_TTYDEV
-  void privileges (rxvt_privaction action);
-  bool saved;
-#endif
 public:
 
   rxvt_ptytty_unix ();