From 8cc05d718c163faefb6512cd66741dd84487bd8b Mon Sep 17 00:00:00 2001 From: Matteo Cypriani Date: Mon, 22 Aug 2011 17:14:16 +0200 Subject: [PATCH] [lib-result] Do not perror() if owl_run is false owl_receive_position() do not print the error message when owl_run is false. This is to avoid an error message when a program is stopped. --- libowlps-resultreader-udp/libowlps-resultreader-udp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libowlps-resultreader-udp/libowlps-resultreader-udp.c b/libowlps-resultreader-udp/libowlps-resultreader-udp.c index 61284b4..96d2320 100644 --- a/libowlps-resultreader-udp/libowlps-resultreader-udp.c +++ b/libowlps-resultreader-udp/libowlps-resultreader-udp.c @@ -13,10 +13,13 @@ /* * Receives a result from the socket of file descriptor 'sockfd', fills * an owl_result structure with the received information, and returns a - * pointer to it (or NULL in case of error). + * pointer to it. * * Note that the new owl_result is allocated with malloc() and must be * deleted using free(). + * + * In case of error, a message is printed, except if owl_run (from + * libowlps) is false, and NULL is returned. */ owl_result* owl_receive_position(int sockfd) { @@ -28,7 +31,8 @@ owl_result* owl_receive_position(int sockfd) if (nread <= 0) { - perror("No request received from listener") ; + if (owl_run) + perror("No request received from listener") ; return NULL ; }