--- ./tests/scripts/common.sh.orig	2021-04-20 07:27:16 +0000
+++ ./tests/scripts/common.sh	2021-04-20 07:28:39 +0000
@@ -57,13 +57,13 @@
 check_if_port_in_use() {
 	local PORT=$1
 	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
 	have_port_finder
-	$PFCMD -anl|grep "[\:\.]$PORT"|grep LISTEN >/dev/null 2>&1
+	$PFCMD -anl|grep LISTEN|grep "[\:\.]$PORT"|grep LISTEN >/dev/null 2>&1
 }
 
 trap "rmdir \"$top_builddir/tests/port.lock.d\" > /dev/null 2>&1 || :" 1 15 2
