* io.c (rb_io_fwrite): workaround for bcc32's fwrite bug.

add errno checking.  [ruby-dev:23627]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
eban 2004-05-27 05:58:32 +00:00
parent decac03616
commit ec6cb67d03
2 changed files with 11 additions and 2 deletions

View File

@ -1,3 +1,8 @@
Thu May 27 14:53:13 2004 WATANABE Hirofumi <eban@ruby-lang.org>
* io.c (rb_io_fwrite): workaround for bcc32's fwrite bug.
add errno checking. [ruby-dev:23627]
Thu May 27 11:25:03 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
* test/csv/test_csv.rb: illegal require module name (../lib/csv.rb).

8
io.c
View File

@ -400,7 +400,7 @@ rb_io_fwrite(ptr, len, f)
long n, r;
if ((n = len) <= 0) return n;
#ifdef __human68k__
#if defined __human68k__ || defined __BORLANDC__
do {
if (fputc(*ptr++, f) == EOF) {
if (ferror(f)) return -1L;
@ -409,7 +409,11 @@ rb_io_fwrite(ptr, len, f)
} while (--n > 0);
#else
while (errno = 0, ptr += (r = fwrite(ptr, 1, n, f)), (n -= r) > 0) {
if (ferror(f)) {
if (ferror(f)
#if defined __BORLANDC__
|| errno == EBAF
#endif
) {
#ifdef __hpux
if (!errno) errno = EAGAIN;
#endif