diff options
-rw-r--r-- | Completion/User/_groups | 3 | ||||
-rw-r--r-- | Src/Modules/zpty.c | 43 |
2 files changed, 24 insertions, 22 deletions
diff --git a/Completion/User/_groups b/Completion/User/_groups index c4d53d32d..748536f3b 100644 --- a/Completion/User/_groups +++ b/Completion/User/_groups @@ -6,7 +6,8 @@ _wanted groups || return 1 if ! zstyle -a ":completion:${curcontext}:" groups groups; then (( $+_cache_groups )) || - if (( ${+commands[ypcat]} )) && tmp=$(ypcat group.byname); then + if (( ${+commands[ypcat]} )) && + tmp=$(_call groups ypcat group.byname); then : ${(A)_cache_groups:=${${(f)tmp}%%:*}} # If you use YP else : ${(A)_cache_groups:=${${(s: :)$(</etc/group)}%%:*}} 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) |