diff options
| author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-29 02:01:19 +0000 |
|---|---|---|
| committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-29 02:01:19 +0000 |
| commit | b1bb19a6ae32400480d38a77c9175d038b6c2c93 (patch) | |
| tree | 9401a315e48b9e162353c47d3c6765722b41d535 | |
| parent | acd96ed74b697011a2578900c5dbd1409b7ca652 (diff) | |
| download | ruby-b1bb19a6ae32400480d38a77c9175d038b6c2c93.tar.gz ruby-b1bb19a6ae32400480d38a77c9175d038b6c2c93.tar.xz ruby-b1bb19a6ae32400480d38a77c9175d038b6c2c93.zip | |
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@20014 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 7 | ||||
| -rw-r--r-- | win32/win32.c | 8 |
2 files changed, 10 insertions, 5 deletions
@@ -1,3 +1,10 @@ +Wed Oct 29 11:00:25 2008 NAKAMURA Usaku <usa@ruby-lang.org> + + * 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. + Wed Oct 29 09:30:04 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> * ruby.c (load_file_internal): use ASCII-8BIT to prevent conversion. diff --git a/win32/win32.c b/win32/win32.c index b70a6d7fa..50fd55d07 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 |
