From 03a2dea9d02dcfaea1679018dd95c802b04f2dbf Mon Sep 17 00:00:00 2001 From: ayin Date: Thu, 19 Jan 2006 16:37:54 +0000 Subject: [PATCH] *** empty log message *** --- src/feature.h | 5 ----- src/ptytty.C | 42 ++++++++++-------------------------------- src/ptytty.h | 11 ++--------- 3 files changed, 12 insertions(+), 46 deletions(-) diff --git a/src/feature.h b/src/feature.h index f56fd4c5..0d842cf0 100644 --- a/src/feature.h +++ b/src/feature.h @@ -258,11 +258,6 @@ #define SELECTION_SCROLL_LINE_SPEEDUP 3 /*--------------------------------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) */ diff --git a/src/ptytty.C b/src/ptytty.C index 33ed72a3..6040c438 100644 --- a/src/ptytty.C +++ b/src/ptytty.C @@ -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) diff --git a/src/ptytty.h b/src/ptytty.h index 3d0e3bb8..b124e23a 100644 --- a/src/ptytty.h +++ b/src/ptytty.h @@ -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 (); -- 2.34.1