* pipe.cc (getov_result): Minor cleanup.

This commit is contained in:
Christopher Faylor 2008-12-22 19:18:00 +00:00
parent 16c40518c0
commit 6ef31d2336
2 changed files with 6 additions and 3 deletions

View File

@ -1,3 +1,7 @@
2008-12-22 Christopher Faylor <me+cygwin@cgf.cx>
* pipe.cc (getov_result): Minor cleanup.
2008-12-20 Christopher Faylor <me+cygwin@cgf.cx> 2008-12-20 Christopher Faylor <me+cygwin@cgf.cx>
* pipe.cc (getov_result): Add parameters to facilitate better EOF * pipe.cc (getov_result): Add parameters to facilitate better EOF

View File

@ -42,7 +42,7 @@ inline bool
getov_result (BOOL res, bool reading, HANDLE h, DWORD& nbytes, LPOVERLAPPED ov) getov_result (BOOL res, bool reading, HANDLE h, DWORD& nbytes, LPOVERLAPPED ov)
{ {
DWORD err = GetLastError (); DWORD err = GetLastError ();
if (res || (reading && ov && !res && err == ERROR_HANDLE_EOF)) if (res || (reading && ov && err == ERROR_HANDLE_EOF))
/* not an error */; /* not an error */;
else if (!ov || (err != ERROR_IO_PENDING) else if (!ov || (err != ERROR_IO_PENDING)
|| (!GetOverlappedResult (h, ov, &nbytes, true) || (!GetOverlappedResult (h, ov, &nbytes, true)
@ -70,7 +70,6 @@ pipe_handler (LPVOID in_ps)
SetHandleInformation (h, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT); SetHandleInformation (h, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT);
SetEvent (ps.ev); SetEvent (ps.ev);
char buf[4096];
DWORD read_bytes, write_bytes; DWORD read_bytes, write_bytes;
HANDLE hread, hwrite, hclose; HANDLE hread, hwrite, hclose;
OVERLAPPED ov, *rov, *wov; OVERLAPPED ov, *rov, *wov;
@ -91,6 +90,7 @@ pipe_handler (LPVOID in_ps)
wov = NULL; wov = NULL;
} }
char buf[4096];
while (1) while (1)
{ {
ResetEvent (ov.hEvent); ResetEvent (ov.hEvent);
@ -151,7 +151,6 @@ out:
CloseHandle (ev); CloseHandle (ev);
ev = NULL; ev = NULL;
} }
return;
} }
void void