Use ZONENAME_MAX and handle errors returned by getzonenamebyid()