mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
win32.c: check error of SetFilePointer
* win32/win32.c (setup_overlapped): check the error code in addition to the result of SetFilePointer() to determine if an error occurred, because INVALID_SET_FILE_POINTER is a valid value. [ruby-core:55098] [Bug #8431] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
38302ca719
commit
a815b56d84
3 changed files with 22 additions and 3 deletions
|
@ -1,4 +1,9 @@
|
||||||
Wed May 22 15:17:30 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Wed May 22 15:18:59 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* win32/win32.c (setup_overlapped): check the error code in addition
|
||||||
|
to the result of SetFilePointer() to determine if an error occurred,
|
||||||
|
because INVALID_SET_FILE_POINTER is a valid value.
|
||||||
|
[ruby-core:55098] [Bug #8431]
|
||||||
|
|
||||||
* win32/win32.c (setup_overlapped, finish_overlapped): extract from
|
* win32/win32.c (setup_overlapped, finish_overlapped): extract from
|
||||||
rb_w32_read() and rb_w32_write().
|
rb_w32_read() and rb_w32_write().
|
||||||
|
|
|
@ -2673,4 +2673,15 @@ End
|
||||||
IO.select(tempfiles)
|
IO.select(tempfiles)
|
||||||
}, bug8080
|
}, bug8080
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_seek_32bit_boundary
|
||||||
|
bug8431 = '[ruby-core:55098] [Bug #8431]'
|
||||||
|
make_tempfile {|t|
|
||||||
|
assert_ruby_status(["-e", <<-"end;", t.path], "", bug8431)
|
||||||
|
f = ARGF.to_io
|
||||||
|
f.seek(0xffff_ffff)
|
||||||
|
f.read(1)
|
||||||
|
end;
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -6028,8 +6028,11 @@ setup_overlapped(OVERLAPPED *ol, int fd)
|
||||||
#define INVALID_SET_FILE_POINTER ((DWORD)-1)
|
#define INVALID_SET_FILE_POINTER ((DWORD)-1)
|
||||||
#endif
|
#endif
|
||||||
if (low == INVALID_SET_FILE_POINTER) {
|
if (low == INVALID_SET_FILE_POINTER) {
|
||||||
errno = map_errno(GetLastError());
|
DWORD err = GetLastError();
|
||||||
return -1;
|
if (err != NO_ERROR) {
|
||||||
|
errno = map_errno(err);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ol->Offset = low;
|
ol->Offset = low;
|
||||||
ol->OffsetHigh = high;
|
ol->OffsetHigh = high;
|
||||||
|
|
Loading…
Reference in a new issue