]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
*endptr should be set in rrd_strtoding, not endptr
authorUpasana <me@upasana.me>
Fri, 11 Jul 2014 17:17:26 +0000 (22:47 +0530)
committerUpasana <me@upasana.me>
Fri, 11 Jul 2014 17:17:26 +0000 (22:47 +0530)
so that value is reflected in the callee function as well

src/rrd_strtod.c

index 9c5fe0eaa0d21df1cd03ca1737e4e6f87fc1a948..0c408274c8f932ca3c7eaea111de7cb151e5f6af 100644 (file)
 /* returns 2 on success */
 /* i.e. if the whole string has been converted to a double successfully */
 unsigned int rrd_strtoding
-(const char * str, char ** endptr, double * dbl, char * error) {
-    char * local_endptr;
+(const char *str, char **endptr, double *dbl, char *error) {
+    char *local_endptr = (char *)str;
     *dbl = rrd_strtod( str, &local_endptr );
 
-    if( endptr != NULL ) endptr = &local_endptr;
+    if (endptr) *endptr = local_endptr;
 
-    if( local_endptr == str ) {
+    if ( local_endptr == (char *)str ) {
         /* no conversion has been done */
         /* for inputs like "abcdj", i.e. no number at all */
         if( error == NULL ) {