From 75ffa984b1116af97a7e8841838dd01fe9d1b9ba Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Mon, 26 Mar 2001 00:47:06 +0000 Subject: [PATCH] (parse_something): do not check the return value from strtod, it might return != 0.0 when the string has no digits. just testing if it consumed any characters is enough and more resilient git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@9758 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/roken/parse_units.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/roken/parse_units.c b/lib/roken/parse_units.c index 0295939cd..fde58e8fb 100644 --- a/lib/roken/parse_units.c +++ b/lib/roken/parse_units.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 1998, 1999 Kungliga Tekniska Högskolan + * Copyright (c) 1997 - 2001 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -84,7 +84,8 @@ parse_something (const char *s, const struct units *units, ++p; val = strtod (p, &next); /* strtol(p, &next, 0); */ - if (val == 0 && p == next) { + if (p == next) { + val = 0; if(!accept_no_val_p) return -1; no_val_p = 1;