summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f5c294b)
raw | patch | inline | side by side (parent: f5c294b)
author | Manuel Luis SanmartĂn Rozada <manuel.luis@gmail.com> | |
Thu, 19 Jun 2014 17:14:53 +0000 (19:14 +0200) | ||
committer | Marc Fournier <marc.fournier@camptocamp.com> | |
Sat, 26 Jul 2014 08:59:40 +0000 (10:59 +0200) |
Conflicts:
src/utils_cmd_putnotif.c
src/utils_cmd_putnotif.c
src/utils_cmd_putnotif.c | patch | blob | history |
index 7c965084318750244091c75c317a01c6271ad2bd..cba08bfa15b3092f249e1cf4503b49ddd2c05f8f 100644 (file)
--- a/src/utils_cmd_putnotif.c
+++ b/src/utils_cmd_putnotif.c
static int set_option_time (notification_t *n, const char *value)
{
- time_t tmp;
-
- tmp = (time_t) atoi (value);
- if (tmp <= 0)
+ char *endptr = NULL;
+ double tmp;
+
+ errno = 0;
+ tmp = strtod (value, &endptr);
+ if ((errno != 0) /* Overflow */
+ || (endptr == value) /* Invalid string */
+ || (endptr == NULL) /* This should not happen */
+ || (*endptr != 0)) /* Trailing chars */
return (-1);
n->time = TIME_T_TO_CDTIME_T (tmp);