rsrv: fix recv() error handling on WIN32

For WIN32 osiSockIoctl_t is unsigned, so

> osiSockIoctl_t nchars = recv(...

is casting signed -> unsigned which treats
errors as success.
This commit is contained in:
Michael Davidsaver
2017-08-01 10:32:09 +02:00
parent 546df1c1f0
commit 5c8e5c52ef

View File

@@ -41,17 +41,18 @@
void camsgtask ( void *pParm )
{
struct client *client = (struct client *) pParm;
int nchars;
int status;
casAttachThreadToClient ( client );
while (castcp_ctl == ctlRun && !client->disconnect) {
osiSockIoctl_t check_nchars;
long nchars;
int status;
/*
* allow message to batch up if more are comming
*/
status = socket_ioctl (client->sock, FIONREAD, &nchars);
status = socket_ioctl (client->sock, FIONREAD, &check_nchars);
if (status < 0) {
char sockErrBuf[64];
@@ -61,7 +62,7 @@ void camsgtask ( void *pParm )
sockErrBuf);
cas_send_bs_msg(client, TRUE);
}
else if (nchars == 0){
else if (check_nchars == 0){
cas_send_bs_msg(client, TRUE);
}