* 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
@ -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>
|
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
|
* 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_COUNT(fp) ((fp)->_egptr - (fp)->_gptr)
|
||||||
# define READ_DATA_PENDING_PTR(fp) ((fp)->_gptr)
|
# define READ_DATA_PENDING_PTR(fp) ((fp)->_gptr)
|
||||||
# endif
|
# 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)
|
#elif defined(FILE_COUNT)
|
||||||
# define READ_DATA_PENDING(fp) ((fp)->FILE_COUNT > 0)
|
# define READ_DATA_PENDING(fp) ((fp)->FILE_COUNT > 0)
|
||||||
# define READ_DATA_PENDING_COUNT(fp) ((fp)->FILE_COUNT)
|
# define READ_DATA_PENDING_COUNT(fp) ((fp)->FILE_COUNT)
|
||||||
@ -3283,6 +3280,7 @@ io_reopen(io, nfile)
|
|||||||
fd = fileno(fptr->f);
|
fd = fileno(fptr->f);
|
||||||
fd2 = fileno(orig->f);
|
fd2 = fileno(orig->f);
|
||||||
if (fd != fd2) {
|
if (fd != fd2) {
|
||||||
|
#if !defined __CYGWIN__
|
||||||
if (fptr->f == stdin || fptr->f == stdout || fptr->f == stderr) {
|
if (fptr->f == stdin || fptr->f == stdout || fptr->f == stderr) {
|
||||||
clearerr(fptr->f);
|
clearerr(fptr->f);
|
||||||
/* need to keep stdio objects */
|
/* need to keep stdio objects */
|
||||||
@ -3290,11 +3288,14 @@ io_reopen(io, nfile)
|
|||||||
rb_sys_fail(orig->path);
|
rb_sys_fail(orig->path);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
#endif
|
||||||
fclose(fptr->f);
|
fclose(fptr->f);
|
||||||
if (dup2(fd2, fd) < 0)
|
if (dup2(fd2, fd) < 0)
|
||||||
rb_sys_fail(orig->path);
|
rb_sys_fail(orig->path);
|
||||||
fptr->f = rb_fdopen(fd, mode);
|
fptr->f = rb_fdopen(fd, mode);
|
||||||
|
#if !defined __CYGWIN__
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
rb_thread_fd_close(fd);
|
rb_thread_fd_close(fd);
|
||||||
if ((orig->mode & FMODE_READABLE) && pos >= 0) {
|
if ((orig->mode & FMODE_READABLE) && pos >= 0) {
|
||||||
if (io_seek(fptr, pos, SEEK_SET) < 0) {
|
if (io_seek(fptr, pos, SEEK_SET) < 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user