Try temp file creation in a different location

... if the standard directory /tmp is not allowed to write to.
As noted in #1273 this might be the case for Termux on Android.
This commit is contained in:
Dirk Wetter 2020-01-14 18:55:09 +01:00
parent 6378371baa
commit 8518284795
1 changed files with 6 additions and 1 deletions

View File

@ -17194,7 +17194,12 @@ EOF
} }
maketempf() { maketempf() {
TEMPDIR=$(mktemp -d /tmp/testssl.XXXXXX) || exit $ERR_FCREATE TEMPDIR=$(mktemp -d /tmp/testssl.XXXXXX)
if [[ $? -ne 0 ]]; then
# for e.g. devices where we can't write to /tmp:
TEMPPATH=$PWD
TEMPDIR=$(mktemp -d $PWD/testssl.XXXXXX) || exit $ERR_FCREATE
fi
TMPFILE=$TEMPDIR/tempfile.txt || exit $ERR_FCREATE TMPFILE=$TEMPDIR/tempfile.txt || exit $ERR_FCREATE
if [[ "$DEBUG" -eq 0 ]]; then if [[ "$DEBUG" -eq 0 ]]; then
ERRFILE="/dev/null" ERRFILE="/dev/null"