summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorwyhaines <wyhaines@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-01-27 18:18:10 +0000
committerwyhaines <wyhaines@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-01-27 18:18:10 +0000
commite2f5883e217808cd72bfdf7a56dadf2023c9dbaf (patch)
tree01dd2c572c9c69f7beb643ed05b464f7bedf44fa /io.c
parent96d07f510a12323095a237ba34ef4dcb8fee566b (diff)
Backport #1916 [ruby-core:24838]; (rb_sysopen): workaround for MSVCRT's bug. Should fix the original bug report which was: File.open crashes when flags File::RDONLY | File::APPEND are passed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@26455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/io.c b/io.c
index 4d930a02cc..360cbd4b97 100644
--- a/io.c
+++ b/io.c
@@ -2791,10 +2791,16 @@ rb_sysopen(fname, flags, mode)
{
int fd;
+#ifdef _WIN32
+ errno = EINVAL;
+#endif
fd = open(fname, flags, mode);
if (fd < 0) {
if (errno == EMFILE || errno == ENFILE) {
rb_gc();
+#ifdef _WIN32
+ errno = EINVAL;
+#endif
fd = open(fname, flags, mode);
}
if (fd < 0) {