--- old/tests/scripts/common.sh	2017-03-01
+++ new/tests/scripts/common.sh	2017-04-10
@@ -49,13 +49,13 @@
 check_if_port_in_use() {
 	local PORT="$1"
 	local PFCMD; have_port_finder
-	$PFCMD -an|grep "[\:\.]$PORT" >/dev/null 2>&1
+	$PFCMD -an|grep LISTEN|grep "[\:\.]$PORT" >/dev/null 2>&1
 }
 
 check_if_port_listening() {
 	local PORT="$1"
 	local PFCMD; have_port_finder
-	$PFCMD -anl|grep "[\:\.]$PORT"|grep LISTEN >/dev/null 2>&1
+	$PFCMD -an|grep LISTEN|grep "[\:\.]$PORT" >/dev/null 2>&1
 }
 
 # Find a port number not currently in use.
