From 1ba45ef26597b82aba81ab20f63a1cb2320dd15e Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Wed, 4 Sep 2019 12:14:46 +0200 Subject: move function to condition... ... and purge a variable. --- udp514-journal.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/udp514-journal.c b/udp514-journal.c index 1065b99..9a1db8b 100644 --- a/udp514-journal.c +++ b/udp514-journal.c @@ -8,7 +8,7 @@ #include "udp514-journal.h" int main(int argc, char **argv) { - int sock, num; + int sock; socklen_t len; struct sockaddr_in cliAddr, servAddr; char buffer[BUFFER_SIZE]; @@ -42,9 +42,7 @@ int main(int argc, char **argv) { memset(buffer, 0, BUFFER_SIZE); len = sizeof(cliAddr); - num = recvfrom(sock, buffer, BUFFER_SIZE, 0, - (struct sockaddr *) &cliAddr, &len); - if (num < 0) { + if (recvfrom(sock, buffer, BUFFER_SIZE, 0, (struct sockaddr *) &cliAddr, &len) < 0) { perror("could not receive data"); continue; } -- cgit v1.2.3-70-g09d2