summaryrefslogtreecommitdiffhomepage
path: root/svr-session.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2007-02-06 16:00:18 +0000
committerMatt Johnston <matt@ucc.asn.au>2007-02-06 16:00:18 +0000
commitcda7af7ca2fe9fb8d848e7891a528e63531a4e8d (patch)
tree936cdb192e15a456a67d52ab439841b4610404c2 /svr-session.c
parentd199e0b1196f39509a92e31d6843193d828bcfab (diff)
parentb1217873364b9c6aa974462b466a795f224249f3 (diff)
merge of '73fe066c5d9e2395354ba74756124d45c978a04d'
and 'f5014cc84558f1e8eba42dbecf9f72f94bfe6134' --HG-- branch : channel-fix extra : convert_revision : cc6095ce978e5f9e51ece6f1717499bc73594bcc
Diffstat (limited to 'svr-session.c')
-rw-r--r--svr-session.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/svr-session.c b/svr-session.c
index 70029f8..fe78bcc 100644
--- a/svr-session.c
+++ b/svr-session.c
@@ -181,10 +181,15 @@ void svr_dropbear_log(int priority, const char* format, va_list param) {
if (!svr_opts.usingsyslog || havetrace)
{
+ struct tm * local_tm = NULL;
timesec = time(NULL);
- if (strftime(datestr, sizeof(datestr), "%b %d %H:%M:%S",
- localtime(&timesec)) == 0) {
- datestr[0] = '?'; datestr[1] = '\0';
+ local_tm = localtime(&timesec);
+ if (local_tm == NULL
+ || strftime(datestr, sizeof(datestr), "%b %d %H:%M:%S",
+ localtime(&timesec)) == 0)
+ {
+ // upon failure, just print the epoch-seconds time.
+ snprintf(datestr, sizeof(datestr), "%d", timesec);
}
fprintf(stderr, "[%d] %s %s\n", getpid(), datestr, printbuf);
}