patches/urxvt-16-ioctl-tty-I_PUSH.diff
author jurikm
Sun, 12 Feb 2012 14:04:10 +0000
changeset 8245 383896da4129
parent 3509 42b6937bbc52
permissions -rw-r--r--
SFEsauerbraten.spec: add IPS package name

diff --git a/src/ptytty.C b/src/ptytty.C
index 73f44fb..cd1f53c 100644
--- a/src/ptytty.C
+++ b/src/ptytty.C
@@ -200,34 +200,6 @@ control_tty (int fd_tty)
 
   setsid ();
 
-#if defined(HAVE_DEV_PTMX) && defined(I_PUSH)
-  /*
-   * Push STREAMS modules:
-   *    ptem: pseudo-terminal hardware emulation module.
-   *    ldterm: standard terminal line discipline.
-   *    ttcompat: V7, 4BSD and XENIX STREAMS compatibility module.
-   *
-   * After we push the STREAMS modules, the first open () on the slave side
-   * (i.e. the next section between the dashes giving us "tty opened OK")
-   * should make the "ptem" (or "ldterm" depending upon either which OS
-   * version or which set of manual pages you have) module give us a
-   * controlling terminal.  We must already have close ()d the master side
-   * fd in this child process before we push STREAMS modules on because the
-   * documentation is really unclear about whether it is any close () on
-   * the master side or the last close () - i.e. a proper STREAMS dismantling
-   * close () - on the master side which causes a hang up to be sent
-   * through - Geoff Wing
-   */
-#if defined(HAVE_ISASTREAM) && defined(HAVE_STROPTS_H)
-  if (isastream (fd_tty) == 1)
-# endif
-    {
-      ioctl (fd_tty, I_PUSH, "ptem");
-      ioctl (fd_tty, I_PUSH, "ldterm");
-      ioctl (fd_tty, I_PUSH, "ttcompat");
-    }
-#endif
-
 #ifdef TIOCSCTTY
   ioctl (fd_tty, TIOCSCTTY, NULL);
 #else
@@ -375,6 +347,34 @@ ptytty_unix::get ()
         }
     }
 
+#if defined(HAVE_DEV_PTMX) && defined(I_PUSH)
+  /*
+   * Push STREAMS modules:
+   *    ptem: pseudo-terminal hardware emulation module.
+   *    ldterm: standard terminal line discipline.
+   *    ttcompat: V7, 4BSD and XENIX STREAMS compatibility module.
+   *
+   * After we push the STREAMS modules, the first open () on the slave side
+   * (i.e. the next section between the dashes giving us "tty opened OK")
+   * should make the "ptem" (or "ldterm" depending upon either which OS
+   * version or which set of manual pages you have) module give us a
+   * controlling terminal.  We must already have close ()d the master side
+   * fd in this child process before we push STREAMS modules on because the
+   * documentation is really unclear about whether it is any close () on
+   * the master side or the last close () - i.e. a proper STREAMS dismantling
+   * close () - on the master side which causes a hang up to be sent
+   * through - Geoff Wing
+   */
+#if defined(HAVE_ISASTREAM) && defined(HAVE_STROPTS_H)
+  if (isastream (tty) == 1)
+# endif
+    {
+      ioctl (tty, I_PUSH, "ptem");
+      ioctl (tty, I_PUSH, "ldterm");
+      ioctl (tty, I_PUSH, "ttcompat");
+    }
+#endif
+
   return true;
 }