summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-01-16 02:22:47 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-01-16 02:22:47 +0000
commit688d00d23b9280d75a75c129382408a057c7109d (patch)
tree11b59c3b644750552c1dcd0af3bd054d41bed31e /win32
parentd3f8488b1cdcd210515e1a81afdc8e3e4a7920b3 (diff)
* win32/win32.c (rb_chsize): no need to get the current file size.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 4804359794..7cb1b31df6 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -4676,18 +4676,15 @@ rb_w32_uaccess(const char *path, int mode)
static int
rb_chsize(HANDLE h, off_t size)
{
- long upos, lpos, usize, lsize, uend, lend;
- off_t end;
+ long upos, lpos, usize, lsize;
int ret = -1;
DWORD e;
- if (((lpos = SetFilePointer(h, 0, (upos = 0, &upos), SEEK_CUR)) == -1L &&
- (e = GetLastError())) ||
- ((lend = GetFileSize(h, (DWORD *)&uend)) == -1L && (e = GetLastError()))) {
+ if ((lpos = SetFilePointer(h, 0, (upos = 0, &upos), SEEK_CUR)) == -1L &&
+ (e = GetLastError())) {
errno = map_errno(e);
return -1;
}
- end = ((off_t)uend << 32) | (unsigned long)lend;
usize = (long)(size >> 32);
lsize = (long)size;
if (SetFilePointer(h, lsize, &usize, SEEK_SET) == (DWORD)-1L &&