Re: [PATCH 03/14] copy_fd: pass error message back through a strbuf
- From
Stefan Beller <sbeller@google.com>
- Date
- Dec 4, 2014, 08:36 UTC
- Message-ID
- <CAGZ79kby-RdwzgXWvVgD42uiEis7SCnuAdSjO2EL03uN4s=LgA@mail.gmail.com>
- In-Reply-To
- <20141204075920.GA27142@peff.net>
> Your solution adds a strbuf. That helps with context and stomping, but > loses readability and adds allocation.
> If we changed the strbuf to a fixed-size buffer, that would help the > allocation issue. Some messages might be truncated, but it seems > unlikely in practice. It still loses readability, though.
> What about a struct that has an errno-like value _and_ a fixed-size > buffer? I'm thinking something like:
What do you mean by the allocation being an issue? We're only populating the error buffer in the error case, so you're not talking about performance/speed I'd assume? As error handling breaks in the least expected ways, I'd rather go with well tested string buffer codes there?