projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
src/daemon/common.c: Add unit test for escape_string().
[collectd.git]
/
src
/
daemon
/
utils_time.c
diff --git
a/src/daemon/utils_time.c
b/src/daemon/utils_time.c
index
6603c15
..
5d905d9
100644
(file)
--- a/
src/daemon/utils_time.c
+++ b/
src/daemon/utils_time.c
@@
-89,11
+89,13
@@
size_t cdtime_to_iso8601 (char *s, size_t max, cdtime_t t) /* {{{ */
if (max - len > 2) {
int n = snprintf (s + len, max - len, ".%09i", (int)t_spec.tv_nsec);
if (max - len > 2) {
int n = snprintf (s + len, max - len, ".%09i", (int)t_spec.tv_nsec);
- len += (n < max - len) ? n : max - len;
+ len += (n < 0) ? 0
+ : (((size_t) n) < (max - len)) ? ((size_t) n)
+ : (max - len);
}
if (max - len > 3) {
}
if (max - len > 3) {
-
in
t n = strftime (s + len, max - len, "%z", &t_tm);
+
size_
t n = strftime (s + len, max - len, "%z", &t_tm);
len += (n < max - len) ? n : max - len;
}
len += (n < max - len) ? n : max - len;
}