Commit 03009aa7 authored by Niklas Hambüchen's avatar Niklas Hambüchen Committed by Ben Gamari

base: fdReady(): Ensure and doc that return values are always -1/0/1

Reviewers: bgamari, austin, hvr, Phyx

Reviewed By: Phyx

Subscribers: Phyx, rwbarton, thomie

Differential Revision: https://phabricator.haskell.org/D4010
parent dddef311
......@@ -40,6 +40,10 @@
*
* This function blocks until either `msecs` have passed, or input is
* available.
*
* Returns:
* 1 => Input ready, 0 => not ready, -1 => error
* On error, sets `errno`.
*/
int
fdReady(int fd, int write, int msecs, int isSock)
......@@ -117,8 +121,7 @@ fdReady(int fd, int write, int msecs, int isSock)
}
}
/* 1 => Input ready, 0 => not ready, -1 => error */
return (ready);
return (ready > 0);
} else {
DWORD rc;
HANDLE hFile = (HANDLE)_get_osfhandle(fd);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment