[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#191656: Support TMPDIR in apt-extracttemplates



Package: apt-utils
Version: 0.5.4
Severity: wishlist
Tags: patch

Subject says all, patch is below.

Wichert.

diff -wur org/apt-0.5.4/cmdline/apt-extracttemplates.cc apt-0.5.4/cmdline/apt-extracttemplates.cc
--- org/apt-0.5.4/cmdline/apt-extracttemplates.cc	2001-04-29 07:40:36.000000000 +0200
+++ apt-0.5.4/cmdline/apt-extracttemplates.cc	2003-05-02 17:31:08.000000000 +0200
@@ -40,8 +40,6 @@
 #include "apt-extracttemplates.h"
 									/*}}}*/
 
-#define TMPDIR		"/tmp"
-
 pkgCache *DebFile::Cache = 0;
 
 // DebFile::DebFile - Construct the DebFile object			/*{{{*/
@@ -245,8 +243,12 @@
 string WriteFile(const char *prefix, const char *data)
 {
 	char fn[512];
+	const char* defaultdir;
 	static int i;
-	snprintf(fn, sizeof(fn), "%s/%s.%u%d", _config->Find("APT::ExtractTemplates::TempDir", TMPDIR).c_str(), prefix, getpid(), i++);
+
+	if ((defaultdir=getenv("TMPDIR"))==NULL)
+		defaultdir="/tmp";
+	snprintf(fn, sizeof(fn), "%s/%s.%u%d", _config->Find("APT::ExtractTemplates::TempDir", defaultdir).c_str(), prefix, getpid(), i++);
 	FileFd f;
 	if (data == NULL)
 		data = "";

-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux tornado 2.5.68 #1 Tue Apr 22 02:36:22 CEST 2003 i686
Locale: LANG=C, LC_CTYPE=en_GB.UTF-8

Versions of packages apt-utils depends on:
ii  apt [libapt-pkg-libc6.2-3-2- 0.5.4       Advanced front-end for dpkg
ii  libc6                        2.3.1-17    GNU C Library: Shared libraries an
ii  libdb2                       2:2.7.7.0-8 The Berkeley database routines (ru
ii  libstdc++2.10-glibc2.2       1:2.95.4-17 The GNU stdc++ library

-- no debconf information


-- 
Wichert Akkerman <wichert@wiggy.net>      It is simple to make things.
http://www.wiggy.net/                     It is hard to make things simple.




Reply to: