test-tcp: Fix printing of "connection reset" when tcp connection closed

This commit is contained in:
Bananymous 2024-06-27 00:39:22 +03:00
parent 31568fc5a1
commit f538dd5276
1 changed files with 1 additions and 2 deletions

View File

@ -99,10 +99,9 @@ int main(int argc, char** argv)
{
ssize_t nrecv = recv(socket, buffer, sizeof(buffer), 0);
if (nrecv == -1)
{
perror("recv");
if (nrecv <= 0)
break;
}
write(STDOUT_FILENO, buffer, nrecv);
}