diff --git a/libowlps/libowlps.c b/libowlps/libowlps.c index 3d8bfbf..d2300a5 100644 --- a/libowlps/libowlps.c +++ b/libowlps/libowlps.c @@ -137,7 +137,7 @@ uint_fast8_t owl_frequency_to_channel(const uint_fast16_t channel) * 'time_ms' is an unsigned value, so please be careful: passing a * negative value may not do what you think. * In case of error, a message is displayed and a non-zero error code - * is returned. + * is returned (if positive, it is the number of non-sleeped seconds). */ int owl_msleep(uint32_t time_ms) { @@ -331,6 +331,7 @@ float owl_swap_float(const float f) * description will be saved. * - client_description (in/out): the structure in which the client * description will be saved. + * Returns a negative error code in case of error. */ int owl_create_udp_trx_socket(const char *const server_address, const uint_fast16_t server_port, @@ -344,7 +345,7 @@ int owl_create_udp_trx_socket(const char *const server_address, if (sockfd < 0) { perror("UDP socket creation failed") ; - return sockfd ; + return -OWL_ERR_SOCKET_CREATE ; } /* Initialise the client structure */ @@ -368,6 +369,7 @@ int owl_create_udp_trx_socket(const char *const server_address, * Creates a UDP reception socket and returns its descriptor. * Parameters: * - port: port on which the socket listens. + * Returns a negative error code in case of error. */ int owl_create_udp_listening_socket(const uint_fast16_t port) { @@ -380,7 +382,7 @@ int owl_create_udp_listening_socket(const uint_fast16_t port) if (sockfd < 0) { perror("UDP socket creation failed") ; - return sockfd ; + return -OWL_ERR_SOCKET_CREATE ; } /* Initialise the server structure */ @@ -397,7 +399,7 @@ int owl_create_udp_listening_socket(const uint_fast16_t port) { perror("Cannot bind the UDP socket") ; close(sockfd) ; - return ret ; + return -OWL_ERR_SOCKET_CREATE ; } return sockfd ;