summaryrefslogtreecommitdiff
path: root/cmdline/apt-get.cc
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2013-12-29 16:04:42 +0100
committerMichael Vogt <mvo@debian.org>2013-12-29 16:04:42 +0100
commitf99a02461efe5183a00d5e73da197b85f93cf57a (patch)
tree1286d59d9700b4626111347bce45820a7cad6aba /cmdline/apt-get.cc
parenta127de147900050d3dbc3644ed468428749c46fd (diff)
parent23bd09778261c945b460b46d855b1a6ef998cfd8 (diff)
Merge remote-tracking branch 'mvo/debian/sid' into debian/sid
Diffstat (limited to 'cmdline/apt-get.cc')
-rw-r--r--cmdline/apt-get.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index 730d3ea18..8a0772ce2 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -1536,14 +1536,12 @@ bool DoChangelog(CommandLine &CmdL)
bool const downOnly = _config->FindB("APT::Get::Download-Only", false);
char tmpname[100];
- char* tmpdir = NULL;
+ const char* tmpdir = NULL;
if (downOnly == false)
{
- const char* const tmpDir = getenv("TMPDIR");
- if (tmpDir != NULL && *tmpDir != '\0')
- snprintf(tmpname, sizeof(tmpname), "%s/apt-changelog-XXXXXX", tmpDir);
- else
- strncpy(tmpname, "/tmp/apt-changelog-XXXXXX", sizeof(tmpname));
+ std::string systemTemp = GetTempDir();
+ snprintf(tmpname, sizeof(tmpname), "%s/apt-changelog-XXXXXX",
+ systemTemp.c_str());
tmpdir = mkdtemp(tmpname);
if (tmpdir == NULL)
return _error->Errno("mkdtemp", "mkdtemp failed");