From: "Andrej Borsenkow" <Andrej.Borsenkow@mow.siemens.ru>
To: "ZSH workers mailing list" <zsh-workers@sunsite.auc.dk>
Subject: PATCH: 3.1.6-dev-19 + patches: zpty.c SINIX/autopush
Date: Fri, 3 Mar 2000 19:33:25 +0300 [thread overview]
Message-ID: <000701bf852e$32a076b0$21c9ca95@mow.siemens.ru> (raw)
- add #if defined(sinix). Dunno, where __SVR4 comes from. Probably, __svr4__
should be there as well (I believe, GCC is using it). But really, we should
test for features not for OSes ...
- modules can be autopushed when tty is opened. It is probably wrong to push
it the second time. The code is paranoid in that it tests for I_FIND failure
(I cannot imagine when it can fail in this case). It also reorders
grantpt()/ptsname() - at least in my docs it is shown this way. Just in
case.
regards
/andrej
--- 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;
+ }
bor@itsrm2% gdiff -u Src/Modules/zpty.c{.org,} > ~/tmp/zpty.diff
bor@itsrm2%
reply other threads:[~2000-03-03 16:33 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='000701bf852e$32a076b0$21c9ca95@mow.siemens.ru' \
--to=andrej.borsenkow@mow.siemens.ru \
--cc=zsh-workers@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).