summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2015-10-23 20:36:03 +0200
committerJulian Andres Klode <jak@debian.org>2015-10-30 15:35:13 +0100
commit42285f827b6a28becc2d47d82f82f74f6ca68a11 (patch)
treef1108a18c11b8c50e9a05f4ac8ebb361584a2846 /apt-pkg
parent2c1e4917d9fac693033723742ec5d4d76fd74c76 (diff)
dpkgpm: Convert users of localtime() to localtime_r()
The former is not thread-safe, whereas the latter is. Gbp-Dch: ignore
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/deb/dpkgpm.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index 5c7710036..7a0253383 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -840,7 +840,8 @@ bool pkgDPkgPM::OpenLog()
// get current time
char timestr[200];
time_t const t = time(NULL);
- struct tm const * const tmp = localtime(&t);
+ struct tm tm_buf;
+ struct tm const * const tmp = localtime_r(&t, &tm_buf);
strftime(timestr, sizeof(timestr), "%F %T", tmp);
// open terminal log
@@ -927,7 +928,8 @@ bool pkgDPkgPM::CloseLog()
{
char timestr[200];
time_t t = time(NULL);
- struct tm *tmp = localtime(&t);
+ struct tm tm_buf;
+ struct tm *tmp = localtime_r(&t, &tm_buf);
strftime(timestr, sizeof(timestr), "%F %T", tmp);
if(d->term_out)