C Error Handling Best Practices