Commit 7072f9db authored by Ondřej Surý's avatar Ondřej Surý
Browse files

Merge branch 'ondrej/fix-get_ports.sh-script' into 'master'

Fix get_ports.sh script

See merge request isc-projects/bind9!3499
parents b1df5842 b071b235
...@@ -18,9 +18,10 @@ statefile=get_ports.state ...@@ -18,9 +18,10 @@ statefile=get_ports.state
port_min=5001 port_min=5001
port_max=32767 port_max=32767
get_random() { get_random() (
dd if=/dev/urandom bs=1 count=2 2>/dev/null | od -tu2 -An # shellcheck disable=SC2005,SC2046
} echo $(dd if=/dev/urandom bs=1 count=2 2>/dev/null | od -tu2 -An) | sed -e 's/^0*//'
)
get_port() { get_port() {
tries=10 tries=10
...@@ -36,7 +37,8 @@ get_port() { ...@@ -36,7 +37,8 @@ get_port() {
port="$1" port="$1"
else else
port_range=$((port_max-port_min)) port_range=$((port_max-port_min))
port=$(($(get_random)%port_range+port_range)) port_random=$(get_random)
port=$((port_random%port_range+port_min))
fi fi
fi fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment