Skip to content

Commit

Permalink
replace "while true" loop
Browse files Browse the repository at this point in the history
  • Loading branch information
phyver committed Jul 9, 2021
1 parent abd546c commit bdf119e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion utils/archive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,17 @@ OUTPUT_DIR=$(dirname "$NAME")
NAME=$(basename "$NAME")

# don't use mktemp -d, which might not exist
while true
for _ in $(seq 100)
do
n=$((n+1))
TMP_DIR="$OUTPUT_DIR/tmp-$(printf "%03d" $n)"
[ -e "$TMP_DIR" ] || break
done
if [ -e "$TMP_DIR" ]
then
echo "Problem with generation of random dirname!" >&2
return 1
fi
mkdir "$TMP_DIR"
mkdir "$TMP_DIR/$NAME"

Expand Down

0 comments on commit bdf119e

Please sign in to comment.