X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fstrutil.c;h=5344ec2903218bef4c7e9baabd3412d10b7929e5;hb=64aa214a22fdbc4a083f3cd6bd06755e6784b96c;hp=3fe59551bbf06776402b78071b1acdb4b24c6ab7;hpb=751ba4c8ed3ec40c85e497fde5bf58185f1d9490;p=libsigrok.git diff --git a/src/strutil.c b/src/strutil.c index 3fe59551..5344ec29 100644 --- a/src/strutil.c +++ b/src/strutil.c @@ -18,6 +18,7 @@ */ #include +#include #include #include #include @@ -67,6 +68,9 @@ SR_PRIV int sr_atol(const char *str, long *ret) errno = 0; tmp = strtol(str, &endptr, 10); + while (endptr && isspace(*endptr)) + endptr++; + if (!endptr || *endptr || errno) { if (!errno) errno = EINVAL; @@ -129,6 +133,9 @@ SR_PRIV int sr_atod(const char *str, double *ret) errno = 0; tmp = strtof(str, &endptr); + while (endptr && isspace(*endptr)) + endptr++; + if (!endptr || *endptr || errno) { if (!errno) errno = EINVAL;