From 0e9de40741c92b0743a90de61767df0fae2eceb8 Mon Sep 17 00:00:00 2001 From: Christos Zoulas Date: Wed, 18 Nov 2009 23:35:14 +0000 Subject: [PATCH] fix for broken ctime/asctime. --- ChangeLog | 5 +++++ src/print.c | 10 +++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index c0d5b807..44ce2bc9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-11-17 18:35 Christos Zoulas @@ -218,7 +218,7 @@ file_fmttime(uint32_t v, int local) (void)time(&now); tm1 = localtime(&now); if (tm1 == NULL) - return "*Invalid time*"; + goto out; daylight = tm1->tm_isdst; } #endif /* HAVE_TM_ISDST */ @@ -227,10 +227,14 @@ file_fmttime(uint32_t v, int local) t += 3600; tm = gmtime(&t); if (tm == NULL) - return "*Invalid time*"; + goto out; pp = asctime(tm); } + if (pp == NULL) + goto out; pp[strcspn(pp, "\n")] = '\0'; return pp; +out: + return "*Invalid time*"; } -- 2.40.0