Tue, 26 Feb 2019 10:22:16 +0100
fixes signed vs unsigned inaccuracy for the -T option
dav/main.c | file | annotate | diff | comparison | revisions | |
libidav/utils.c | file | annotate | diff | comparison | revisions | |
libidav/utils.h | file | annotate | diff | comparison | revisions |
--- a/dav/main.c Tue Feb 26 10:17:19 2019 +0100 +++ b/dav/main.c Tue Feb 26 10:22:16 2019 +0100 @@ -2004,7 +2004,7 @@ timeout = -1; } else { uint64_t i; - if(util_strtoint(timeoutstr, &i)) { + if(util_strtouint(timeoutstr, &i)) { timeout = (time_t)i; } else { fprintf(stderr, "Error: -T option has invalid value\n");
--- a/libidav/utils.c Tue Feb 26 10:17:19 2019 +0100 +++ b/libidav/utils.c Tue Feb 26 10:22:16 2019 +0100 @@ -200,6 +200,18 @@ return 0; } +int util_strtouint(char *str, uint64_t *value) { + char *end; + errno = 0; + uint64_t val = strtoull(str, &end, 0); + if(errno == 0) { + *value = val; + return 1; + } else { + return 0; + } +} + int util_strtoint(char *str, int64_t *value) { char *end; errno = 0;
--- a/libidav/utils.h Tue Feb 26 10:17:19 2019 +0100 +++ b/libidav/utils.h Tue Feb 26 10:22:16 2019 +0100 @@ -78,6 +78,7 @@ char* util_parent_path(char *path); int util_getboolean(char *v); +int util_strtouint(char *str, uint64_t *value); int util_strtoint(char *str, int64_t *value); char* util_xml_get_text(const xmlNode *elm);