[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.
This commit is contained in:
Matteo Cypriani 2011-08-22 17:14:16 +02:00
parent 632858155a
commit 8cc05d718c
1 changed files with 6 additions and 2 deletions

View File

@ -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 ;
}