summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-20 03:43:14 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-20 03:43:14 +0000
commite5b938812d8cef6f6c786b5a92c686389d4f8463 (patch)
treed3d7a91b6bb9ca8ee9d627c212c7e00c35f76510
parent2d08493e2203da31865386ba2900cbfa76f68d8a (diff)
downloadruby-e5b938812d8cef6f6c786b5a92c686389d4f8463.tar.gz
ruby-e5b938812d8cef6f6c786b5a92c686389d4f8463.tar.xz
ruby-e5b938812d8cef6f6c786b5a92c686389d4f8463.zip
* io.c (io_fwrite): workaround for MSVCRT's bug.
fixed: [ruby-core:03982] git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@7608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--io.c8
2 files changed, 13 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index fe4ee3e50..2a6ea96ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Dec 20 12:42:17 2004 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * io.c (io_fwrite): workaround for MSVCRT's bug.
+ fixed: [ruby-core:03982]
+
Mon Dec 20 11:21:04 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
* io.c (rb_io_eof): check if closed before clearerr().
diff --git a/io.c b/io.c
index f6ea3a115..7e4de9633 100644
--- a/io.c
+++ b/io.c
@@ -431,6 +431,14 @@ io_fwrite(str, fptr)
) {
#ifdef __hpux
if (!errno) errno = EAGAIN;
+#elif defined(_WIN32) && !defined(__BORLANDC__)
+ /* workaround for MSVCRT's bug */
+ if (!errno) {
+ if (GetLastError() == ERROR_NO_DATA)
+ errno = EPIPE;
+ else
+ errno = EBADF;
+ }
#endif
if (rb_io_wait_writable(fileno(f))) {
rb_io_check_closed(fptr);