Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.

Commit

Permalink
comms:http:server: Handle strtod errors properly
Browse files Browse the repository at this point in the history
When strtod returns an FP_SUBNORMAL the variable errno is set. To check
for errors properly it's necessary to check errno and if the returned value
is zero.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
  • Loading branch information
ceolin committed Sep 25, 2015
1 parent 93ac3ac commit 63156ac
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/modules/flow/http-server/http-server.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
*/

#include <errno.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -536,7 +537,7 @@ float_response_cb(void *data, struct sol_http_request *request)
modified = true; \
mdata->value.d.field_ = sol_util_strtodn(value->value.key_value.value, NULL, \
-1, false); \
if (errno != 0) { \
if ((fpclassify(mdata->value.d.field_) == FP_ZERO) && (errno != 0)) { \
r = -errno; \
goto end; \
} \
Expand Down

0 comments on commit 63156ac

Please sign in to comment.