From 2609e7cea39fb32a999acef014ea9ce6e9b3d141 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Fri, 23 Oct 2015 20:45:21 +0200 Subject: dpkgpm: Convert ctime() call to ctime_r() ctime() is not thread-safe, ctime_r() is. Gbp-Dch: ignore --- apt-pkg/deb/dpkgpm.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 8f652b3df..0f195b921 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -1839,7 +1839,8 @@ void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg) fprintf(report, "ProblemType: Package\n"); fprintf(report, "Architecture: %s\n", arch.c_str()); time_t now = time(NULL); - fprintf(report, "Date: %s" , ctime(&now)); + char ctime_buf[26]; // need at least 26 bytes according to ctime(3) + fprintf(report, "Date: %s" , ctime_r(&now, ctime_buf)); fprintf(report, "Package: %s %s\n", pkgname.c_str(), pkgver.c_str()); fprintf(report, "SourcePackage: %s\n", Ver.SourcePkgName()); fprintf(report, "ErrorMessage:\n %s\n", errormsg); -- cgit v1.2.3-70-g09d2