mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* io.c (io_reopen): work around problem with Cygwin fseeko
returning ESPIPE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
643ac551dc
commit
9b25eee46e
2 changed files with 9 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
|||
Sat Nov 20 17:48:29 2004 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||
|
||||
* io.c (io_reopen): work around problem with Cygwin fseeko
|
||||
returning ESPIPE.
|
||||
|
||||
Tue Nov 20 05:34:24 2004 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* ext/nkf/nkf-utf8/nkf.c: original nkf.c rev:1.40
|
||||
|
|
7
io.c
7
io.c
|
@ -127,9 +127,6 @@ static VALUE lineno = INT2FIX(0);
|
|||
# define READ_DATA_PENDING_COUNT(fp) ((fp)->_egptr - (fp)->_gptr)
|
||||
# define READ_DATA_PENDING_PTR(fp) ((fp)->_gptr)
|
||||
# endif
|
||||
#elif defined(HAVE___FPENDING)
|
||||
# define READ_DATA_PENDING(fp) (__fpending(fp) > 0)
|
||||
# define READ_DATA_PENDING_COUNT(fp) (__fpending(fp))
|
||||
#elif defined(FILE_COUNT)
|
||||
# define READ_DATA_PENDING(fp) ((fp)->FILE_COUNT > 0)
|
||||
# define READ_DATA_PENDING_COUNT(fp) ((fp)->FILE_COUNT)
|
||||
|
@ -3283,6 +3280,7 @@ io_reopen(io, nfile)
|
|||
fd = fileno(fptr->f);
|
||||
fd2 = fileno(orig->f);
|
||||
if (fd != fd2) {
|
||||
#if !defined __CYGWIN__
|
||||
if (fptr->f == stdin || fptr->f == stdout || fptr->f == stderr) {
|
||||
clearerr(fptr->f);
|
||||
/* need to keep stdio objects */
|
||||
|
@ -3290,11 +3288,14 @@ io_reopen(io, nfile)
|
|||
rb_sys_fail(orig->path);
|
||||
}
|
||||
else {
|
||||
#endif
|
||||
fclose(fptr->f);
|
||||
if (dup2(fd2, fd) < 0)
|
||||
rb_sys_fail(orig->path);
|
||||
fptr->f = rb_fdopen(fd, mode);
|
||||
#if !defined __CYGWIN__
|
||||
}
|
||||
#endif
|
||||
rb_thread_fd_close(fd);
|
||||
if ((orig->mode & FMODE_READABLE) && pos >= 0) {
|
||||
if (io_seek(fptr, pos, SEEK_SET) < 0) {
|
||||
|
|
Loading…
Reference in a new issue