зеркало из https://github.com/github/ruby.git
ext/pty/pty.c: I_FIND before I_PUSH if possible
* ext/pty/pty.c: Check whether each STREAMS module is already pushed or not by using I_FIND ioctl call, before pushing it by using I_PUSH. Solved test failure on Solaris. On a Solaris 10 machine, ioctl I_PUSH "ldterm" twice was the cause of duplicated "\r". [Bug #14786] [ruby-dev:50552] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
e6ad53beaa
Коммит
26cbe46e68
|
@ -224,6 +224,21 @@ no_mesg(char *slavedevice, int nomesg)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(I_PUSH) && !defined(__linux__) && !defined(_AIX)
|
||||||
|
static inline int
|
||||||
|
ioctl_I_PUSH(int fd, const char *const name)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
# if defined(I_FIND)
|
||||||
|
ret = ioctl(fd, I_FIND, name);
|
||||||
|
# endif
|
||||||
|
if (ret == 0) {
|
||||||
|
ret = ioctl(fd, I_PUSH, name);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int
|
static int
|
||||||
get_device_once(int *master, int *slave, char SlaveName[DEVICELEN], int nomesg, int fail)
|
get_device_once(int *master, int *slave, char SlaveName[DEVICELEN], int nomesg, int fail)
|
||||||
{
|
{
|
||||||
|
@ -268,9 +283,9 @@ get_device_once(int *master, int *slave, char SlaveName[DEVICELEN], int nomesg,
|
||||||
rb_update_max_fd(slavefd);
|
rb_update_max_fd(slavefd);
|
||||||
|
|
||||||
#if defined(I_PUSH) && !defined(__linux__) && !defined(_AIX)
|
#if defined(I_PUSH) && !defined(__linux__) && !defined(_AIX)
|
||||||
if (ioctl(slavefd, I_PUSH, "ptem") == -1) goto error;
|
if (ioctl_I_PUSH(slavefd, "ptem") == -1) goto error;
|
||||||
if (ioctl(slavefd, I_PUSH, "ldterm") == -1) goto error;
|
if (ioctl_I_PUSH(slavefd, "ldterm") == -1) goto error;
|
||||||
if (ioctl(slavefd, I_PUSH, "ttcompat") == -1) goto error;
|
if (ioctl_I_PUSH(slavefd, "ttcompat") == -1) goto error;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
*master = masterfd;
|
*master = masterfd;
|
||||||
|
@ -352,9 +367,9 @@ get_device_once(int *master, int *slave, char SlaveName[DEVICELEN], int nomesg,
|
||||||
if((slavefd = rb_cloexec_open(slavedevice, O_RDWR, 0)) == -1) goto error;
|
if((slavefd = rb_cloexec_open(slavedevice, O_RDWR, 0)) == -1) goto error;
|
||||||
rb_update_max_fd(slavefd);
|
rb_update_max_fd(slavefd);
|
||||||
#if defined(I_PUSH) && !defined(__linux__) && !defined(_AIX)
|
#if defined(I_PUSH) && !defined(__linux__) && !defined(_AIX)
|
||||||
if(ioctl(slavefd, I_PUSH, "ptem") == -1) goto error;
|
if(ioctl_I_PUSH(slavefd, "ptem") == -1) goto error;
|
||||||
if(ioctl(slavefd, I_PUSH, "ldterm") == -1) goto error;
|
if(ioctl_I_PUSH(slavefd, "ldterm") == -1) goto error;
|
||||||
ioctl(slavefd, I_PUSH, "ttcompat");
|
ioctl_I_PUSH(slavefd, "ttcompat");
|
||||||
#endif
|
#endif
|
||||||
*master = masterfd;
|
*master = masterfd;
|
||||||
*slave = slavefd;
|
*slave = slavefd;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче