zsh-workers
 help / color / mirror / code / Atom feed
* (Fwd) RE: PATCH: 3.1.6-dev-19 + patches: zpty.c SINIX/autopush
@ 2000-03-03 18:45 Bart Schaefer
  0 siblings, 0 replies; only message in thread
From: Bart Schaefer @ 2000-03-03 18:45 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 1008 bytes --]

Andrej sent this to me, but I'm sure it should have gone to the list.

This should be used INSTEAD OF my attempt to fix it, which lost some bits.

--- Forwarded mail from "Andrej Borsenkow" <Andrej.Borsenkow@mow.siemens.ru>

From: "Andrej Borsenkow" <Andrej.Borsenkow@mow.siemens.ru>
To: "Bart Schaefer" <schaefer@candle.brasslantern.com>
Subject: RE: PATCH: 3.1.6-dev-19 + patches: zpty.c SINIX/autopush
Date: Fri, 3 Mar 2000 21:06:06 +0300

>
> Malformed patch again, Andrej.  You need a better email client ...
>

It depends upon your definition of "better" :-) But I really want to repeat
once more - once upon a time MIME was invented exactly to solve these
problems ... and your mail bears a MIME-Version header as well :->

Here it is as attachment.

cheers

/andrej


---End of forwarded mail from "Andrej Borsenkow" <Andrej.Borsenkow@mow.siemens.ru>

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

[-- Attachment #2: zpty.diff --]
[-- Type: application/octet-stream , Size: 1490 bytes --]

--- Src/Modules/zpty.c.org	Fri Mar  3 11:50:37 2000
+++ Src/Modules/zpty.c	Fri Mar  3 18:33:24 2000
@@ -158,7 +158,7 @@
 
 #else /* ! __osf__ */
 
-#if __SVR4
+#if defined(__SVR4) || defined(sinix)
 
 #include <sys/stropts.h>
 
@@ -167,11 +167,12 @@
 {
     int mfd, sfd;
     char *name;
+    int ret;
 
     if ((mfd = open("/dev/ptmx", O_RDWR)) < 0)
 	return 1;
 
-    if (!(name = ptsname(mfd)) || grantpt(mfd) || unlockpt(mfd)) {
+    if (grantpt(mfd) || unlockpt(mfd) || !(name = ptsname(mfd))) {
 	close(mfd);
 	return 1;
     }
@@ -179,20 +180,31 @@
 	close(mfd);
 	return 1;
     }
-    if (ioctl(sfd, I_PUSH, "ptem") ||
-	ioctl(sfd, I_PUSH, "ldterm") ||
-	ioctl(sfd, I_PUSH, "ttcompat")) {
-	close(mfd);
-	close(sfd);
-	return 1;
-    }
+    if ((ret = ioctl(sfd, I_FIND, "ptem")) != 1)
+	if (ret == -1 || ioctl(sfd, I_PUSH, "ptem") == -1) {
+	    close(mfd);
+	    close(sfd);
+	    return 1;
+	}
+    if ((ret = ioctl(sfd, I_FIND, "ldterm")) != 1)
+	if (ret == -1 || ioctl(sfd, I_PUSH, "ldterm") == -1) {
+	    close(mfd);
+	    close(sfd);
+	    return 1;
+	}
+    if ((ret = ioctl(sfd, I_FIND, "ttcompat")) != 1)
+	if (ret == -1 || ioctl(sfd, I_PUSH, "ttcompat") == -1) {
+	    close(mfd);
+	    close(sfd);
+	    return 1;
+	}
     *master = mfd;
     *slave = sfd;
 
     return 0;
 }
 
-#else /* ! __SVR4 */
+#else /* ! (defined(__SVR4) || defined(sinix))  */
 
 static int
 get_pty(int *master, int *slave)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-03-03 18:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-03-03 18:45 (Fwd) RE: PATCH: 3.1.6-dev-19 + patches: zpty.c SINIX/autopush Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).