Fix lstat error handling.