diff options
author | Daniel Mack <github@zonque.org> | 2016-01-21 11:50:08 +0100 |
---|---|---|
committer | Daniel Mack <github@zonque.org> | 2016-01-21 11:50:08 +0100 |
commit | 9ecbcdffdf15bb76f57e8c403070dd43e206858d (patch) | |
tree | 421146d2e57a799d6ee8e62f3f80bcf4eba87885 /src/test/test-date.c | |
parent | 5c9ddf7ff49a89639e0d7fe86022f5f125803f45 (diff) | |
parent | 2a836ca9703689ba05513c98fb293b91a186a9ac (diff) |
Merge pull request #2391 from keszybz/coverity
Coverity inspired fixes
Diffstat (limited to 'src/test/test-date.c')
-rw-r--r-- | src/test/test-date.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/test/test-date.c b/src/test/test-date.c index c6d8bf82ea..851d384117 100644 --- a/src/test/test-date.c +++ b/src/test/test-date.c @@ -27,14 +27,16 @@ static void test_should_pass(const char *p) { usec_t t, q; - char buf[FORMAT_TIMESTAMP_MAX], buf_relative[FORMAT_TIMESTAMP_RELATIVE_MAX]; + char buf[FORMAT_TIMESTAMP_MAX], buf_relative[FORMAT_TIMESTAMP_RELATIVE_MAX], *sp; assert_se(parse_timestamp(p, &t) >= 0); format_timestamp_us(buf, sizeof(buf), t); log_info("%s", buf); /* Chop off timezone */ - *strrchr(buf, ' ') = 0; + sp = strrchr(buf, ' '); + assert_se(sp); + *sp = 0; assert_se(parse_timestamp(buf, &q) >= 0); assert_se(q == t); |