diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-03-31 11:57:56 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-03-31 11:57:56 -0400 |
commit | c0441cca8b483882f5676b98081f0fe4b52d3ae1 (patch) | |
tree | 0f6234deb72feb4de4c80ecbf4b0f0b0e89269f7 /src/common/tortls.c | |
parent | 4ebad0d947cbb74b674468e6601894468629f814 (diff) | |
parent | 3118af2d5fca7999a94d73690d83463ddacf9acb (diff) | |
download | tor-c0441cca8b483882f5676b98081f0fe4b52d3ae1.tar.gz tor-c0441cca8b483882f5676b98081f0fe4b52d3ae1.zip |
Merge branch 'bug8787_squashed'
Diffstat (limited to 'src/common/tortls.c')
-rw-r--r-- | src/common/tortls.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/common/tortls.c b/src/common/tortls.c index 8defab2adb..9ba8fd683e 100644 --- a/src/common/tortls.c +++ b/src/common/tortls.c @@ -2312,6 +2312,7 @@ log_cert_lifetime(int severity, const X509 *cert, const char *problem) char mytime[33]; time_t now = time(NULL); struct tm tm; + size_t n; if (problem) tor_log(severity, LD_GENERAL, @@ -2337,11 +2338,17 @@ log_cert_lifetime(int severity, const X509 *cert, const char *problem) BIO_get_mem_ptr(bio, &buf); s2 = tor_strndup(buf->data, buf->length); - strftime(mytime, 32, "%b %d %H:%M:%S %Y UTC", tor_gmtime_r(&now, &tm)); - - tor_log(severity, LD_GENERAL, - "(certificate lifetime runs from %s through %s. Your time is %s.)", - s1,s2,mytime); + n = strftime(mytime, 32, "%b %d %H:%M:%S %Y UTC", tor_gmtime_r(&now, &tm)); + if (n > 0) { + tor_log(severity, LD_GENERAL, + "(certificate lifetime runs from %s through %s. Your time is %s.)", + s1,s2,mytime); + } else { + tor_log(severity, LD_GENERAL, + "(certificate lifetime runs from %s through %s. " + "Couldn't get your time.)", + s1, s2); + } end: /* Not expected to get invoked */ |