summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2011-04-02 17:59:10 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2011-04-02 17:59:10 +0200
commit410327e1ee0fac0c28a95e45ea75f7359cc8dcb4 (patch)
treeb9006a26913889c4cb23c8025405ca0151ced6c4 /apt-pkg
parent8ff84cf381c254565aa3e1837265f9991909e576 (diff)
let TimeRFC1123 return an empty string if gmtime() fails
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/contrib/strutl.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index ace738d7a..072dda3ac 100644
--- a/apt-pkg/contrib/strutl.cc
+++ b/apt-pkg/contrib/strutl.cc
@@ -692,9 +692,11 @@ int StringToBool(const string &Text,int Default)
year 2000 complient and timezone neutral */
string TimeRFC1123(time_t Date)
{
- struct tm Conv = *gmtime(&Date);
- char Buf[300];
+ struct tm Conv;
+ if (gmtime_r(&Date, &Conv) == NULL)
+ return "";
+ char Buf[300];
const char *Day[] = {"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
const char *Month[] = {"Jan","Feb","Mar","Apr","May","Jun","Jul",
"Aug","Sep","Oct","Nov","Dec"};