From: Thomas Bechtold Date: Sun, 22 Dec 2013 10:40:49 +0000 (+0100) Subject: apt-pkg/contrib/gpgv.cc: use /tmp as fallback dir X-Git-Tag: 0.9.14.2~5 X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/38beb8b5936e9d85a5bb99bf3860f082bbe34439?ds=inline apt-pkg/contrib/gpgv.cc: use /tmp as fallback dir if the directory given by $TMPDIR is not available, use /tmp as fallback. --- 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;