Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2009-01-27 08:21:08 +0300
committerChristopher Faylor <me@cgf.cx>2009-01-27 08:21:08 +0300
commit1ae0cd1335fd4874c7d3291e397d665cb4a19477 (patch)
tree79276873e271ba518611e3638e220548386c9eb4 /winsup/cygwin/fhandler.cc
parentdcad81990b772be891c2b04e508a983cbd4da612 (diff)
* fhandler.cc (fhandler_base::wait_overlapped): Set bytes to -1 on EINTR or
real error. (fhandler_base::write_overlapped): Assume that bytes_written will contain proper error value. * pipe.cc (fhandler_pipe::fhandler_pipe): Set uninterruptible_io since signals are handled by pipe functions now.
Diffstat (limited to 'winsup/cygwin/fhandler.cc')
-rw-r--r--winsup/cygwin/fhandler.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index cb2877dd8..d1f21ec23 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -1697,7 +1697,7 @@ fhandler_base::wait_overlapped (bool inres, bool writing, DWORD *bytes)
return inres;
int res = 0;
- *bytes = (DWORD) -1;
+
DWORD err;
if (inres || ((err = GetLastError ()) == ERROR_IO_PENDING))
{
@@ -1722,6 +1722,7 @@ fhandler_base::wait_overlapped (bool inres, bool writing, DWORD *bytes)
{
debug_printf ("got a signal");
set_errno (EINTR);
+ *bytes = (DWORD) -1;
res = 0;
err = 0;
}
@@ -1732,7 +1733,7 @@ fhandler_base::wait_overlapped (bool inres, bool writing, DWORD *bytes)
}
else
{
- debug_printf ("normal read");
+ debug_printf ("normal %s, %u bytes", writing ? "write" : "read", *bytes);
res = 1;
err = 0;
}
@@ -1744,6 +1745,7 @@ fhandler_base::wait_overlapped (bool inres, bool writing, DWORD *bytes)
{
debug_printf ("err %u", err);
__seterrno_from_win_error (err);
+ *bytes = (DWORD) -1;
res = -1;
}
else
@@ -1787,10 +1789,9 @@ fhandler_base::write_overlapped (const void *ptr, size_t len)
bool res = WriteFile (get_output_handle (), ptr, len, &bytes_written,
get_overlapped ());
int wres = wait_overlapped (res, true, &bytes_written);
- if (wres < 0)
- return -1;
if (wres || !_my_tls.call_signal_handler ())
break;
}
+ debug_printf ("returning %u", bytes_written);
return bytes_written;
}