summaryrefslogtreecommitdiff
path: root/ext/pty
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pty')
-rw-r--r--ext/pty/extconf.rb2
-rw-r--r--ext/pty/pty.c10
2 files changed, 6 insertions, 6 deletions
diff --git a/ext/pty/extconf.rb b/ext/pty/extconf.rb
index 51a4bc7cd3..ec35879a33 100644
--- a/ext/pty/extconf.rb
+++ b/ext/pty/extconf.rb
@@ -3,12 +3,12 @@ require 'mkmf'
if /mswin32|mingw/ !~ RUBY_PLATFORM
have_header("sys/stropts.h")
have_func("setresuid")
- $CFLAGS << "-DHAVE_DEV_PTMX" if /cygwin/ === RUBY_PLATFORM
have_header("libutil.h")
have_header("pty.h")
have_library("util", "openpty")
if have_func("openpty") or
have_func("_getpty") or
+ have_func("ptsname") or
have_func("ioctl")
create_makefile('pty')
end
diff --git a/ext/pty/pty.c b/ext/pty/pty.c
index 1760ebf598..def44b6f41 100644
--- a/ext/pty/pty.c
+++ b/ext/pty/pty.c
@@ -349,7 +349,7 @@ getDevice(master,slave)
int i,j;
char MasterName[DEVICELEN];
-#ifdef HAVE_DEV_PTMX
+#ifdef HAVE_PTSNAME
char *pn;
void (*s)();
@@ -364,7 +364,7 @@ getDevice(master,slave)
if(unlockpt(i) != -1) {
if((pn = ptsname(i)) != NULL) {
if((j = open(pn, O_RDWR, 0)) != -1) {
-#if defined I_PUSH
+#if defined I_PUSH && !defined linux
if(ioctl(j, I_PUSH, "ptem") != -1) {
if(ioctl(j, I_PUSH, "ldterm") != -1) {
#endif
@@ -372,7 +372,7 @@ getDevice(master,slave)
*slave = j;
strcpy(SlaveName, pn);
return;
-#if defined I_PUSH
+#if defined I_PUSH && !defined linux
}
}
#endif
@@ -385,10 +385,10 @@ getDevice(master,slave)
rb_raise(rb_eRuntimeError, "Cannot get Master/Slave device");
#else
for (p = deviceNo; *p != NULL; p++) {
- sprintf(MasterName ,MasterDevice,*p);
+ sprintf(MasterName,MasterDevice,*p);
if ((i = open(MasterName,O_RDWR,0)) >= 0) {
*master = i;
- sprintf(SlaveName ,SlaveDevice,*p);
+ sprintf(SlaveName,SlaveDevice,*p);
if ((j = open(SlaveName,O_RDWR,0)) >= 0) {
*slave = j;
chown(SlaveName, getuid(), getgid());