[squid-dev] Removal of xstrerror?

Alex Rousskov rousskov at measurement-factory.com
Mon May 18 18:12:28 UTC 2015


On 05/12/2015 04:11 PM, Amos Jeffries wrote:
> On 13/05/2015 7:30 a.m., Alex Dowad wrote:

>> I'm just questioning whether removing xstrerror is really desirable
>> in cases where it is called without any intervening library
>> function call which could overwrite errno. Amos, are you sure
>> that's what you want to do?


> I am. It's just a macro in compat/ representing "xstrerr(errno)" and as
> you and others have been finding its used incorrectly often enough to
> cause problems.


I agree with Amos. There are no known good reasons for that macro to
exist, and we know it has been misused.

As for predicting when errno value is preserved, doing so correctly is
nearly impossible in many cases because of C++ operators and other
implicit calls that may trigger I/O (debugging) and/or memory allocation
system calls. Any code that does not save the errno value immediately
after the system call but uses it "later" should be rewritten.


Cheers,

Alex.



More information about the squid-dev mailing list