diff options
Diffstat (limited to 'Src/Modules/zpty.c')
-rw-r--r-- | Src/Modules/zpty.c | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/Src/Modules/zpty.c b/Src/Modules/zpty.c index 63135c31b..26896525c 100644 --- a/Src/Modules/zpty.c +++ b/Src/Modules/zpty.c @@ -165,7 +165,7 @@ get_pty(int *master, int *slave) #else /* ! __osf__ */ -#if __SVR4 +#if defined(__SVR4) || defined(sinix) #include <sys/stropts.h> @@ -174,11 +174,12 @@ get_pty(int *master, int *slave) { 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; } @@ -186,31 +187,31 @@ get_pty(int *master, int *slave) close(mfd); 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; - } + 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 /* ! (defined(__SVR4) || defined(sinix)) */ +#else /* ! (defined(__SVR4) || defind(sinix)) */ static int get_pty(int *master, int *slave) |