X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Futils_cmd_putval.c;h=826e1b0390fb53dbb7944a96bc5a29616edfded7;hb=25ac639c505394e4ae9600ee62f5d5aeea97c6d4;hp=639b8ab1b432b526d7c1815bc86bd9c05c551aa5;hpb=a3529866c3d98643d7857d2d0ad751c73f312c4e;p=collectd.git diff --git a/src/utils_cmd_putval.c b/src/utils_cmd_putval.c index 639b8ab1..826e1b03 100644 --- a/src/utils_cmd_putval.c +++ b/src/utils_cmd_putval.c @@ -1,6 +1,6 @@ /** * collectd - src/utils_cms_putval.c - * Copyright (C) 2007,2008 Florian octo Forster + * Copyright (C) 2007-2009 Florian octo Forster * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -65,12 +65,13 @@ static int dispatch_values (const data_set_t *ds, value_list_t *vl, break; } - if (strcmp (ptr, "U") == 0) + if ((strcmp (ptr, "U") == 0) && (ds->ds[i].type == DS_TYPE_GAUGE)) vl->values[i].gauge = NAN; - else if (ds->ds[i].type == DS_TYPE_COUNTER) - vl->values[i].counter = atoll (ptr); - else if (ds->ds[i].type == DS_TYPE_GAUGE) - vl->values[i].gauge = atof (ptr); + else if (0 != parse_value (ptr, &vl->values[i], ds->ds[i])) + { + print_to_socket (fh, "-1 Failed to parse value `%s'.\n", ptr); + return (-1); + } i++; } /* while (strtok_r) */