summaryrefslogtreecommitdiff
path: root/cmdline/apt-extracttemplates.cc
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 17:02:23 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 17:02:23 +0000
commit8eb5af513dca4b456e86ca6a08efbf93ee23848b (patch)
treed2684971367625521bc57fc6258b124446a0560c /cmdline/apt-extracttemplates.cc
parent90defbfd5b4e7636f4e4404da873dc2c59f14916 (diff)
* Support TMPDIR in apt-extracttemplates (Closes: #191656)
Author: mdz Date: 2003-07-26 00:00:11 GMT * Support TMPDIR in apt-extracttemplates (Closes: #191656)
Diffstat (limited to 'cmdline/apt-extracttemplates.cc')
-rw-r--r--cmdline/apt-extracttemplates.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/cmdline/apt-extracttemplates.cc b/cmdline/apt-extracttemplates.cc
index 73b3bc51c..eecb7fe2f 100644
--- a/cmdline/apt-extracttemplates.cc
+++ b/cmdline/apt-extracttemplates.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: apt-extracttemplates.cc,v 1.14 2003/01/11 07:18:44 jgg Exp $
+// $Id: apt-extracttemplates.cc,v 1.15 2003/07/26 00:00:11 mdz Exp $
/* ######################################################################
APT Extract Templates - Program to extract debconf config and template
@@ -249,7 +249,15 @@ string WriteFile(const char *package, const char *prefix, const char *data)
{
char fn[512];
static int i;
- snprintf(fn, sizeof(fn), "%s/%s.%s.%u%d", _config->Find("APT::ExtractTemplates::TempDir", TMPDIR).c_str(), package, prefix, getpid(), i++);
+ char *tempdir = NULL;
+
+ tempdir = getenv("TMPDIR");
+ if (tempdir == NULL)
+ tempdir = TMPDIR;
+
+ snprintf(fn, sizeof(fn), "%s/%s.%s.%u%d",
+ _config->Find("APT::ExtractTemplates::TempDir", tempdir).c_str(),
+ package, prefix, getpid(), i++);
FileFd f;
if (data == NULL)
data = "";