* fhandler.cc (fhandler_base::read_overlapped): Preserve len when looping due

to received signal.
This commit is contained in:
Christopher Faylor 2009-06-16 19:05:43 +00:00
parent 1c5e84dd08
commit 4844eaa5f8
2 changed files with 9 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2009-06-16 Christopher Faylor <me+cygwin@cgf.cx>
* fhandler.cc (fhandler_base::read_overlapped): Preserve len when
looping due to received signal.
2009-06-15 Corinna Vinschen <corinna@vinschen.de>
* net.cc (get_flags): New static function to generate interface flags

View File

@ -1772,21 +1772,22 @@ fhandler_base::wait_overlapped (bool inres, bool writing, DWORD *bytes, DWORD le
void
fhandler_base::read_overlapped (void *ptr, size_t& len)
{
DWORD bytes_written;
while (1)
{
bool res = ReadFile (get_handle (), ptr, len, (DWORD *) &len,
bool res = ReadFile (get_handle (), ptr, len, &bytes_written,
get_overlapped ());
int wres = wait_overlapped (res, false, (DWORD *) &len);
int wres = wait_overlapped (res, false, &bytes_written);
if (wres || !_my_tls.call_signal_handler ())
break;
}
len = (size_t) bytes_written;
}
int
fhandler_base::write_overlapped (const void *ptr, size_t len)
{
DWORD bytes_written;
while (1)
{
bool res = WriteFile (get_output_handle (), ptr, len, &bytes_written,