1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-22 20:44:19 +00:00

Fix missing close() for invalid commands

This commit is contained in:
Kano 2011-11-23 15:57:47 +11:00
parent 2358056606
commit 89c221ad8a

9
api.c
View File

@ -288,13 +288,9 @@ void api()
}
inet_ntop(AF_INET, &(cli.sin_addr), &(tmpaddr[0]), sizeof(tmpaddr)-1);
if (strcmp(tmpaddr, addr) != 0)
close(c);
else {
if (strcmp(tmpaddr, addr) == 0) {
n = read(c, &buf[0], BUFSIZ-1);
if (n < 0)
close(c);
else {
if (n >= 0) {
buf[n] = '\0';
params = strchr(buf, '|');
if (params != NULL)
@ -310,6 +306,7 @@ void api()
}
}
}
close(c);
}
close(sock);