From 62bc09adf3dc3c3024af391744cfe34fc00621b9 Mon Sep 17 00:00:00 2001 From: Jeff Grafton Date: Tue, 19 Jan 2016 15:04:12 -0800 Subject: [PATCH] Only return unprivileged ports in get_random_port and fix nc argument bug --- hack/lib/util.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hack/lib/util.sh b/hack/lib/util.sh index 00179f888e0..b4ebec1ecf8 100755 --- a/hack/lib/util.sh +++ b/hack/lib/util.sh @@ -50,7 +50,7 @@ kube::util::wait_for_url() { # returns a random port kube::util::get_random_port() { - awk -v min=1 -v max=65535 'BEGIN{srand(); print int(min+rand()*(max-min+1))}' + awk -v min=1024 -v max=65535 'BEGIN{srand(); print int(min+rand()*(max-min+1))}' } # use netcat to check if the host($1):port($2) is free (return 0 means free, 1 means used) @@ -65,7 +65,7 @@ kube::util::test_host_port_free() { return ${success} } - if [ ! $(nc -vz "${host} ${port}") ]; then + if [ ! $(nc -vz "${host}" "${port}") ]; then kube::log::status "${host}:${port} is free, proceeding..." return ${success} else