program dumps core when getpeername() returns EINVAL (#1085)