summaryrefslogtreecommitdiff
path: root/cmdline/apt-extracttemplates.cc
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2013-12-22 22:15:52 +0100
committerMichael Vogt <mvo@debian.org>2013-12-22 22:15:52 +0100
commit68e0172140872d8044b3c768a6bea3ac58d426c4 (patch)
tree8562f0708130ee1b628e256c49be31f8c1c7e1b2 /cmdline/apt-extracttemplates.cc
parent38beb8b5936e9d85a5bb99bf3860f082bbe34439 (diff)
factor GetTempDir out
Diffstat (limited to 'cmdline/apt-extracttemplates.cc')
-rw-r--r--cmdline/apt-extracttemplates.cc11
1 files changed, 3 insertions, 8 deletions
diff --git a/cmdline/apt-extracttemplates.cc b/cmdline/apt-extracttemplates.cc
index 8fe15fdf9..8e1937113 100644
--- a/cmdline/apt-extracttemplates.cc
+++ b/cmdline/apt-extracttemplates.cc
@@ -47,8 +47,6 @@
using namespace std;
-#define TMPDIR "/tmp"
-
pkgCache *DebFile::Cache = 0;
// DebFile::DebFile - Construct the DebFile object /*{{{*/
@@ -253,14 +251,11 @@ string WriteFile(const char *package, const char *prefix, const char *data)
{
char fn[512];
static int i;
- const char *tempdir = NULL;
-
- tempdir = getenv("TMPDIR");
- if (tempdir == NULL)
- tempdir = TMPDIR;
+ std::string tempdir = GetTempDir();
snprintf(fn, sizeof(fn), "%s/%s.%s.%u%d",
- _config->Find("APT::ExtractTemplates::TempDir", tempdir).c_str(),
+ _config->Find("APT::ExtractTemplates::TempDir",
+ tempdir.c_str()).c_str(),
package, prefix, getpid(), i++);
FileFd f;
if (data == NULL)