Skip to content

Commit

Permalink
easyrsa_mktemp(): Rename 'target' -> 'want_tmp_file' - Avoid conflicts
Browse files Browse the repository at this point in the history
Signed-off-by: Richard T Bonhomme <[email protected]>
  • Loading branch information
TinCanTech committed Apr 15, 2023
1 parent 6e80d08 commit 8c1971e
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions easyrsa3/easyrsa
Original file line number Diff line number Diff line change
Expand Up @@ -703,23 +703,25 @@ easyrsa_mktemp: shot-file created: $shotfile"
# which is why this extension is required.
# Current max required is 7 deep
for i in 1 2 3 4 5 6 7 8 9; do
target="${t}.${i}"
if [ -e "$target" ]; then
want_tmp_file="${t}.${i}"
if [ -e "$want_tmp_file" ]; then
verbose "\
easyrsa_mktemp: temp-file EXISTS: $target"
easyrsa_mktemp: temp-file EXISTS: $want_tmp_file"
continue
else
# atomic:
[ "$easyrsa_host_os" = win ] && \
set -o noclobber

if mv "$shotfile" "$target"; then
if mv "$shotfile" "$want_tmp_file"; then
verbose "\
easyrsa_mktemp: atomic: Create temp-file OK: $target"
easyrsa_mktemp: atomic: Create temp-file OK: $want_tmp_file"
# Assign external temp-file name
if force_set_var "$1" "$target"; then
if force_set_var "$1" "$want_tmp_file"
then
[ "$easyrsa_host_os" = win ] && \
set +o noclobber
unset -v want_tmp_file shotfile
return 0
else
die "\
Expand All @@ -733,7 +735,7 @@ easyrsa_mktemp - force_set_var $1 failed"

die "\
easyrsa_mktemp - failed for: $1 @ depth=$i
target: $target"
want_tmp_file: $want_tmp_file"
} # => easyrsa_mktemp()

# remove temp files and do terminal cleanups
Expand Down

0 comments on commit 8c1971e

Please sign in to comment.