mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 21:14:23 +02:00
* configure.in: check pipe2.
* io.c (rb_cloexec_pipe): use pipe2 if available. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33574 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a3efca16a1
commit
e7f8c03818
3 changed files with 25 additions and 1 deletions
18
io.c
18
io.c
|
@ -266,7 +266,25 @@ int
|
|||
rb_cloexec_pipe(int fildes[2])
|
||||
{
|
||||
int ret;
|
||||
|
||||
#if defined(HAVE_PIPE2)
|
||||
static int try_pipe2 = 1;
|
||||
if (try_pipe2) {
|
||||
ret = pipe2(fildes, O_CLOEXEC);
|
||||
if (ret != -1)
|
||||
return ret;
|
||||
/* pipe2 is available since Linux 2.6.27. */
|
||||
if (errno == ENOSYS) {
|
||||
try_pipe2 = 0;
|
||||
ret = pipe(fildes);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ret = pipe(fildes);
|
||||
}
|
||||
#else
|
||||
ret = pipe(fildes);
|
||||
#endif
|
||||
if (ret == -1) return -1;
|
||||
#ifdef __CYGWIN__
|
||||
if (ret == 0 && fildes[1] == -1) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue