Skip to content

Instantly share code, notes, and snippets.

@wanabe
Created April 25, 2010 03:13
Show Gist options
  • Save wanabe/378131 to your computer and use it in GitHub Desktop.
Save wanabe/378131 to your computer and use it in GitHub Desktop.
diff --git a/ChangeLog b/ChangeLog
index 0176047..eeec688 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Sun Apr 25 12:02:42 2010 wanabe <[email protected]>
+
+ * process.c (run_exec_open): move file pointer to avoid msvcrt's bug.
+
Sun Apr 25 11:02:20 2010 wanabe <[email protected]>
* hash.c (ruby_setenv): putenv on msvcrt.dll can't remove empty value.
diff --git a/process.c b/process.c
index 4f68d69..56fcbaa 100644
--- a/process.c
+++ b/process.c
@@ -2094,6 +2094,11 @@ run_exec_open(VALUE ary, VALUE save, char *errmsg, size_t errmsg_buflen)
ERRMSG("open");
return -1;
}
+#if defined(_WIN32)
+ if (flags & O_APPEND) {
+ lseek(fd2, 0, SEEK_END);
+ }
+#endif
while (i < RARRAY_LEN(ary) &&
(elt = RARRAY_PTR(ary)[i], RARRAY_PTR(elt)[1] == param)) {
fd = FIX2INT(RARRAY_PTR(elt)[0]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment