[Aggregator] Use perror() after recvfrom()

Use perror() instead of fprintf() after the recvfrom() calls.
Fix the test in listen_for_aps().
This commit is contained in:
Matteo Cypriani 2011-07-23 23:00:42 +02:00
parent 0f54bd36a3
commit f951ce95f2
1 changed files with 3 additions and 3 deletions

View File

@ -434,7 +434,7 @@ int read_loop(int sockfd)
{ {
if (owl_run) if (owl_run)
{ {
fprintf(stderr, "No request received from client!\n") ; perror("No request received from listener") ;
ret = ERR_NO_MESSAGE_RECEIVED ; ret = ERR_NO_MESSAGE_RECEIVED ;
} }
break ; break ;
@ -880,10 +880,10 @@ void* listen_for_aps(void *NULL_value)
nread = recvfrom(listen_sockfd, &message, sizeof(message), 0, nread = recvfrom(listen_sockfd, &message, sizeof(message), 0,
(struct sockaddr *) &client, &client_len) ; (struct sockaddr *) &client, &client_len) ;
if (nread <= 0 && owl_run) if (nread <= 0)
{ {
if (owl_run) if (owl_run)
fprintf(stderr, "No message received from listener!\n") ; perror("No message received from listener") ;
continue ; continue ;
} }