Adjusted error handling to user errno as the definitive flag