mirror of
https://github.com/GOSTSec/ccminer
synced 2025-08-26 13:51:51 +00:00
api: fix possible issue on linux
This commit is contained in:
parent
0961544c85
commit
5b1b77ba95
4
api.cpp
4
api.cpp
@ -1252,7 +1252,7 @@ static void api()
|
|||||||
char *wskey = NULL;
|
char *wskey = NULL;
|
||||||
n = recv(c, &buf[0], SOCK_REC_BUFSZ, 0);
|
n = recv(c, &buf[0], SOCK_REC_BUFSZ, 0);
|
||||||
|
|
||||||
fail = SOCKETFAIL(n);
|
fail = SOCKETFAIL(n) || n < 0;
|
||||||
if (fail)
|
if (fail)
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
else if (n > 0 && buf[n-1] == '\n') {
|
else if (n > 0 && buf[n-1] == '\n') {
|
||||||
@ -1261,7 +1261,7 @@ static void api()
|
|||||||
if (n > 0 && buf[n-1] == '\r')
|
if (n > 0 && buf[n-1] == '\r')
|
||||||
buf[n-1] = '\0';
|
buf[n-1] = '\0';
|
||||||
}
|
}
|
||||||
buf[n] = '\0';
|
else buf[n] = '\0';
|
||||||
|
|
||||||
//if (opt_debug && opt_protocol && n > 0)
|
//if (opt_debug && opt_protocol && n > 0)
|
||||||
// applog(LOG_DEBUG, "API: recv command: (%d) '%s'+char(%x)", n, buf, buf[n-1]);
|
// applog(LOG_DEBUG, "API: recv command: (%d) '%s'+char(%x)", n, buf, buf[n-1]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user