api: fix possible issue on linux
This commit is contained in:
1 parent
0961544c85
commit
5b1b77ba95
1 file changed
+2
-2
@@ -1252,7 +1252,7 @@ static void api()
|
||||
char *wskey = NULL;
|
||||
n = recv(c, &buf[0], SOCK_REC_BUFSZ, 0);
|
||||
|
||||
fail = SOCKETFAIL(n);
|
||||
fail = SOCKETFAIL(n) || n < 0;
|
||||
if (fail)
|
||||
buf[0] = '\0';
|
||||
else if (n > 0 && buf[n-1] == '\n') {
|
||||
@@ -1261,7 +1261,7 @@ static void api()
|
||||
if (n > 0 && buf[n-1] == '\r')
|
||||
buf[n-1] = '\0';
|
||||
}
|
||||
buf[n] = '\0';
|
||||
else buf[n] = '\0';
|
||||
|
||||
//if (opt_debug && opt_protocol && n > 0)
|
||||
// applog(LOG_DEBUG, "API: recv command: (%d) '%s'+char(%x)", n, buf, buf[n-1]);
|
||||
|
||||
Reference in new issue
Block a user