Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorChristian Heusel <christian@heusel.eu>2024-06-15 14:23:21 +0200
committerChristian Heusel <christian@heusel.eu>2024-06-15 14:55:18 +0200
commit1df0979da6bbe5de8549693d12cb3e547bc6d94a (patch)
tree09769ebb64ed7164854a91b4dc5949bae01889a7 /src/lib
parentc1a3ed224b8d735fec0456233b68c5a583299d79 (diff)
fix(common): guard the WORKDIR environment var
This avoids the unwanted removal of the folder if someone has already pre-defined the variable. Fixes #219 Suggested-by: Levente Polyak <anthraxx@archlinux.org> Signed-off-by: Christian Heusel <christian@heusel.eu>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/common.sh2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/lib/common.sh b/src/lib/common.sh
index b087bb1..5416eaf 100644
--- a/src/lib/common.sh
+++ b/src/lib/common.sh
@@ -120,6 +120,8 @@ print_workdir_error() {
}
_setup_workdir=false
+# Ensure that there is no outside value for WORKDIR leaking in
+unset WORKDIR
setup_workdir() {
[[ -z ${WORKDIR:-} ]] && WORKDIR=$(mktemp -d --tmpdir "${0##*/}.XXXXXXXXXX")
_setup_workdir=true