ubox: properly handle return codes