From 491682978b3434153cf51c68ef0721828d0d1c07 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Mon, 23 Sep 2019 10:45:38 +0200 Subject: rotate-keys: abort if tmp_dir cannot be created --- rotate-keys.in | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rotate-keys.in b/rotate-keys.in index 970d533..952595b 100644 --- a/rotate-keys.in +++ b/rotate-keys.in @@ -82,7 +82,12 @@ if trap \ exit 1 fi -tmp_dir=$(mktemp -d "${webserver_dir}"'/tmp.XXXXXXXXXX') +if ! tmp_dir=$(mktemp -d "${webserver_dir}"'/tmp.XXXXXXXXXX'); then + >&2 printf 'failed to create temporary directory - does %s have sufficient permissions on "%s"?\n' \ + "$(whoami)" \ + "${webserver_dir}" + exit 1 +fi trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT printf '%s\n' "${hosts}" \ -- cgit v1.2.3-70-g09d2