Ret value instead of errno