From 38beb8b5936e9d85a5bb99bf3860f082bbe34439 Mon Sep 17 00:00:00 2001 From: Thomas Bechtold Date: Sun, 22 Dec 2013 11:40:49 +0100 Subject: apt-pkg/contrib/gpgv.cc: use /tmp as fallback dir if the directory given by $TMPDIR is not available, use /tmp as fallback. --- apt-pkg/contrib/gpgv.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/contrib/gpgv.cc b/apt-pkg/contrib/gpgv.cc index f47e7ea48..8f619fee2 100644 --- a/apt-pkg/contrib/gpgv.cc +++ b/apt-pkg/contrib/gpgv.cc @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -22,11 +23,15 @@ static char * GenerateTemporaryFileTemplate(const char *basename) /*{{{*/ { const char *tmpdir = getenv("TMPDIR"); + #ifdef P_tmpdir if (!tmpdir) tmpdir = P_tmpdir; #endif - if (!tmpdir) + + // check that tmpdir is set and exists + struct stat st; + if (!tmpdir || stat(tmpdir, &st) != 0) tmpdir = "/tmp"; std::string out; -- cgit v1.2.3