Fix error detection in build_port(), broken in [dd568a526c]