Fix port checking on FreeBSD.