* Support TMPDIR in apt-extracttemplates (Closes: #191656)
authorArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 17:02:23 +0000 (17:02 +0000)
committerArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 17:02:23 +0000 (17:02 +0000)
Author: mdz
Date: 2003-07-26 00:00:11 GMT
* Support TMPDIR in apt-extracttemplates (Closes: #191656)

cmdline/apt-extracttemplates.cc
debian/changelog

index 73b3bc5..eecb7fe 100644 (file)
@@ -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 = "";
index e4b1c02..8507170 100644 (file)
@@ -18,6 +18,7 @@ apt (0.5.8) unstable; urgency=medium
   * Tweak SGML in apt-extracttemplates.1.sgml so that literal '>' doesn't end
     up in output
   * Document SrcDirectory in apt-ftparchive.1.sgml (Closes: #156370)
+  * Support TMPDIR in apt-extracttemplates (Closes: #191656)
 
  -- Matt Zimmerman <mdz@debian.org>  Fri, 25 Jul 2003 19:44:16 -0400