diff options
author | Julian Andres Klode <jak@debian.org> | 2015-10-23 20:36:03 +0200 |
---|---|---|
committer | Julian Andres Klode <jak@debian.org> | 2015-10-30 15:35:13 +0100 |
commit | 42285f827b6a28becc2d47d82f82f74f6ca68a11 (patch) | |
tree | f1108a18c11b8c50e9a05f4ac8ebb361584a2846 | |
parent | 2c1e4917d9fac693033723742ec5d4d76fd74c76 (diff) | |
download | apt-42285f827b6a28becc2d47d82f82f74f6ca68a11.tar.gz |
dpkgpm: Convert users of localtime() to localtime_r()
The former is not thread-safe, whereas the latter is.
Gbp-Dch: ignore
-rw-r--r-- | apt-pkg/deb/dpkgpm.cc | 6 |
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) |