Explorar o código

dpkgpm: Convert ctime() call to ctime_r()

ctime() is not thread-safe, ctime_r() is.

Gbp-Dch: ignore
Julian Andres Klode %!s(int64=10) %!d(string=hai) anos
pai
achega
2609e7cea3
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      apt-pkg/deb/dpkgpm.cc

+ 2 - 1
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);