1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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/trunk@20014 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2008-10-29 02:01:19 +00:00
parent bc4bc3a80f
commit 4542baa983
2 changed files with 10 additions and 5 deletions

View file

@ -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.

View file

@ -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