summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-29 02:01:54 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-29 02:01:54 +0000
commitb3b3c1746169183d9c97a90f9d0df2e8d7f6d3c0 (patch)
tree0ad6ebb0a27a01887db82e2c980c287c9eb08d7c /win32
parenta6a18d4693944e6485ae814191b335be88f9be9a (diff)
downloadruby-b3b3c1746169183d9c97a90f9d0df2e8d7f6d3c0.tar.gz
* win32/win32.c (rb_w32_open): shouldn't seek here.
* win32/win32.c (rb_w32_write): write to the end of the file when FAPPEND is specified. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@20015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/win32/win32.c b/win32/win32.c
index b70a6d7fa6..50fd55d076 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -4129,10 +4129,8 @@ rb_w32_open(const char *file, int oflag, ...)
fd = -1;
goto quit;
}
- if (!(flags & (FDEV | FPIPE)) && (oflag & O_APPEND)) {
+ if (!(flags & (FDEV | FPIPE)) && (oflag & O_APPEND))
flags |= FAPPEND;
- SetFilePointer(h, 0, NULL, FILE_END);
- }
_set_osfhnd(fd, (long)h);
_osfile(fd) = flags | FOPEN;
@@ -4431,8 +4429,8 @@ rb_w32_write(int fd, const void *buf, size_t size)
memset(&ol, 0, sizeof(ol));
if (!(_osfile(fd) & (FDEV | FPIPE))) {
LONG high = 0;
- DWORD low = SetFilePointer((HANDLE)_osfhnd(fd), 0, &high,
- FILE_CURRENT);
+ DWORD method = _osfile(fd) & FAPPEND ? FILE_END : FILE_CURRENT;
+ DWORD low = SetFilePointer((HANDLE)_osfhnd(fd), 0, &high, method);
#ifndef INVALID_SET_FILE_POINTER
#define INVALID_SET_FILE_POINTER ((DWORD)-1)
#endif