aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2011-08-24 22:38:39 +0300
committerArnold D. Robbins <arnold@skeeve.com>2011-08-24 22:38:39 +0300
commitcfba2eb6f221d0f94643a57c135c62f5bc66ee10 (patch)
tree7b68bfa649df78953254cc19f15ec4f5fa9cc3f6 /io.c
parent337577552dfabe64647be9415a41fd13f96bf0cf (diff)
downloadegawk-cfba2eb6f221d0f94643a57c135c62f5bc66ee10.tar.gz
egawk-cfba2eb6f221d0f94643a57c135c62f5bc66ee10.tar.bz2
egawk-cfba2eb6f221d0f94643a57c135c62f5bc66ee10.zip
Fix pty coprocess on Ubuntu.
Diffstat (limited to 'io.c')
-rw-r--r--io.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/io.c b/io.c
index 1dcf217b..6e1d06ad 100644
--- a/io.c
+++ b/io.c
@@ -34,6 +34,9 @@
#undef RE_DUP_MAX /* avoid spurious conflict w/regex.h */
#include <sys/param.h>
#endif /* HAVE_SYS_PARAM_H */
+#ifdef HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif /* HAVE_SYS_IOCTL_H */
#ifndef O_ACCMODE
#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
@@ -1696,9 +1699,6 @@ two_way_open(const char *str, struct redirect *rp)
ioctl(slave, I_PUSH, "ldterm");
#endif
-#ifdef TIOCSCTTY
- ioctl(slave, TIOCSCTTY, 0);
-#endif
tcgetattr(slave, &st);
st.c_iflag &= ~(ISTRIP | IGNCR | INLCR | IXOFF);
st.c_iflag |= (ICRNL | IGNPAR | BRKINT | IXON);
@@ -1735,6 +1735,10 @@ two_way_open(const char *str, struct redirect *rp)
/* Child process */
setsid();
+#ifdef TIOCSCTTY
+ ioctl(slave, TIOCSCTTY, 0);
+#endif
+
if (close(master) == -1)
fatal(_("close of master pty failed (%s)"), strerror(errno));
if (close(1) == -1)