aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2021-06-25 07:34:03 +0000
committermerakor <cem@ckyln.com>2021-06-25 07:34:03 +0000
commit0962927eb9a132f4323c8685a5ce3934a2f31c32 (patch)
treec607c336ddf21694c60ea2bc0368e4126075cbb3
parent4ecfa39446c156e4283dae252532ce8548c72652 (diff)
downloadcpt-0962927eb9a132f4323c8685a5ce3934a2f31c32.tar.gz
main(): don't create $tmp_dir, only declare its variable
FossilOrigin-Name: 6fd840fac7d14a2116ad4b2a69b82e2f10f1bbee0ecdc4cd7cc788ab1c530881
-rw-r--r--src/cpt-lib.in6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/cpt-lib.in b/src/cpt-lib.in
index 0d418e6..4e687c4 100644
--- a/src/cpt-lib.in
+++ b/src/cpt-lib.in
@@ -2081,11 +2081,15 @@ create_cache() {
# We create the temporary directory here to avoid permission issues that can
# arise from functions that call as_root().
mkdir -p "${cac_dir:=${CPT_CACHE:=${XDG_CACHE_HOME:-$HOME/.cache}/cpt}}" \
- "${tmp_dir:=${CPT_TMPDIR:=$cac_dir/proc}/$pid}" \
+ "${CPT_TMPDIR:=$cac_dir/proc}" \
"${src_dir:=$cac_dir/sources}" \
"${log_dir:=$cac_dir/logs}" \
"${bin_dir:=$cac_dir/bin}"
+ # We don't create the temporary $pid directory until `create_tmp()` is
+ # called, but we still declare its variable here.
+ : "${tmp_dir:=${CPT_TMPDIR:=$cac_dir/proc}/$pid}"
+
# Set the location to the repository and package database.
pkg_db=var/db/cpt/installed