commit-inetutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU Inetutils branch, master, updated. inetutils-1_9_4-34-g5f02a4


From: Mats Erik Andersson
Subject: [SCM] GNU Inetutils branch, master, updated. inetutils-1_9_4-34-g5f02a4d
Date: Sat, 4 Mar 2017 13:59:09 -0500 (EST)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".

The branch, master has been updated
       via  5f02a4d818cc627cf11e2a3817774a1a7cae59dc (commit)
      from  e0b19a99126c32b3566cedbedc517c2707c26c55 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=5f02a4d818cc627cf11e2a3817774a1a7cae59dc


commit 5f02a4d818cc627cf11e2a3817774a1a7cae59dc
Author: Mats Erik Andersson <address@hidden>
Date:   Sat Mar 4 19:55:28 2017 +0100

    telnetd: Use tty, not pty on Solaris.
    
    Three cases more where terminal capabilities must
    be set via the slave descriptor, not the master.

diff --git a/ChangeLog b/ChangeLog
index 14b51b5..967de10 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2017-03-04  Mats Erik Andersson  <address@hidden>
+
+       telnetd: Use tty, not pty on Solaris.
+       Setting of terminal attributes as well setting of window size
+       must be done via the slave descriptor, not the master descriptor.
+
+       * telnetd/term.c [SOLARIS || SOLARIS10] (set_termbuf):
+       New variables NAME, TTY.  A call to ptsname() reveals whether
+       `pty' is a master.  Then open that file, update TTY, and call
+       _term_setattr().
+       [SOLARIS || SOLARIS10] (init_termbuf): Simplify to use a single
+       call to _term_getattr(), similar to set_termbuf().
+       * telnetd/termstat.c: Include <fcntl.h>.
+       [TIOCSWINSZ && (SOLARIS || SOLARIS10)] (clientstat) <TELOPT_NAWS>:
+       New variables NAME, TTY.  Similar mechanism as above, but call
+       ioctl with window size.
+       [TIOCSWINSZ && (SOLARIS || SOLARIS10)] (defer_terminit): Likewise.
+
 2017-03-03  Mats Erik Andersson  <address@hidden>
 
        Test utility displays some termcaps.
diff --git a/telnetd/term.c b/telnetd/term.c
index a190e28..7ddbe46 100644
--- a/telnetd/term.c
+++ b/telnetd/term.c
@@ -503,7 +503,9 @@ tty_iscrnl (void)
 void
 init_termbuf (void)
 {
-#if defined SOLARIS10 || defined SOLARIS
+#if !defined SOLARIS10 && !defined SOLARIS
+  _term_getattr (pty, &termbuf);
+#else /* SOLARIS || SOLARIS10 */
   /* On Solaris the master PTY is not able to report terminal
    * settings about the slave TTY, since it is only the slave
    * that is working with an designated line discipline.
@@ -512,21 +514,18 @@ init_termbuf (void)
    * This happens for the parent process.  The child process
    * sees an empty name, so undergoes minimal processing.
    */
-  char *name = ptsname(pty);
+  int tty = pty;
+  char *name = ptsname (pty);
 
-  if (!name)
-    _term_getattr (pty, &termbuf);
-  else
-    {
-      /* Minimal access means read only!  */
-      int tty = open(name, O_RDONLY | O_NONBLOCK);
+  if (name)
+    /* Minimal access means read only!  */
+    tty = open (name, O_RDONLY | O_NONBLOCK);
 
-      _term_getattr (tty, &termbuf);
-      close(tty);
-    }
-#else /* !SOLARIS && !SOLARIS10 */
-  _term_getattr (pty, &termbuf);
-#endif
+  _term_getattr (tty, &termbuf);
+
+  if (name)
+    close (tty);
+#endif /* SOLARIS || SOLARIS10 */
 
   termbuf2 = termbuf;
 }
@@ -555,7 +554,23 @@ void
 set_termbuf (void)
 {
   if (memcmp (&termbuf, &termbuf2, sizeof (termbuf)))
+#if !defined SOLARIS10 && !defined SOLARIS
     _term_setattr (pty, &termbuf);
+#else /* SOLARIS || SOLARIS10 */
+    {
+      /* Same reason as with _term_getattr.  */
+      int tty = pty;
+      char *name = ptsname (pty);
+
+      if (name)
+       tty = open (name, O_RDWR | O_NONBLOCK | O_NOCTTY);
+
+      _term_setattr (tty, &termbuf);
+
+      if (name)
+       close (tty);
+    }
+#endif /* SOLARIS || SOLARIS10 */
 }
 
 /* spcset(func, valp, valpp)
diff --git a/telnetd/termstat.c b/telnetd/termstat.c
index 5f9e2ef..a3e37d0 100644
--- a/telnetd/termstat.c
+++ b/telnetd/termstat.c
@@ -51,6 +51,8 @@
 
 #include "telnetd.h"
 
+#include <fcntl.h>     /* Solaris */
+
 /*
  * local variables
  */
@@ -591,7 +593,23 @@ clientstat (register int code, register int parm1, 
register int parm2)
 
        ws.ws_col = parm1;
        ws.ws_row = parm2;
+
+# if !defined SOLARIS && !defined SOLARIS10
        ioctl (pty, TIOCSWINSZ, (char *) &ws);
+# else /* SOLARIS || SOLARIS10 */
+       {
+         int tty = pty;
+         char *name = ptsname (pty);
+
+         if (name)
+           tty = open (name, O_RDWR | O_NONBLOCK | O_NOCTTY);
+
+         ioctl (tty, TIOCSWINSZ, (char *) &ws);
+
+         if (name)
+           close (tty);
+       }
+# endif /* SOLARIS || SOLARIS10 */
       }
 #endif /* TIOCSWINSZ */
 
@@ -682,9 +700,25 @@ defer_terminit (void)
       memset ((char *) &ws, 0, sizeof (ws));
       ws.ws_col = def_col;
       ws.ws_row = def_row;
+
+# if !defined SOLARIS && !defined SOLARIS10
       ioctl (pty, TIOCSWINSZ, (char *) &ws);
+# else /* SOLARIS || SOLARIS10 */
+      {
+       int tty = pty;
+       char *name = ptsname (pty);
+
+       if (name)
+         tty = open (name, O_RDWR | O_NONBLOCK | O_NOCTTY);
+
+       ioctl (tty, TIOCSWINSZ, (char *) &ws);
+
+       if (name)
+         close (tty);
+      }
+# endif /* SOLARIS || SOLARIS10 */
     }
-#endif
+#endif /* TIOCSWINSZ */
 
   /*
    * The only other module that currently defers anything.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog          | 18 ++++++++++++++++++
 telnetd/term.c     | 43 +++++++++++++++++++++++++++++--------------
 telnetd/termstat.c | 36 +++++++++++++++++++++++++++++++++++-
 3 files changed, 82 insertions(+), 15 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]