[squid-dev] [PATCH] avoid clobbering errno in debugs()

Amos Jeffries squid3 at treenet.co.nz
Sun Jul 12 08:20:52 UTC 2015


On 12/07/2015 7:03 p.m., Kinkie wrote:
> I tried it. Unfortunately it fails for those cases of debugs() which do not
> use xstrerror, e.g.
> 
> ../../src/esi/Element.h: In member function 'virtual bool
> ESIElement::addElement(ESIElement::Pointer)':
> ../../src/esi/Element.h:64:74: error: unused variable '_squid_errno'
> [-Werror=unused-variable]
>          debugs(86,5, "ESIElement::addElement: Failed for " << this);
> 
> :(
> I believe putting the burden of saving state to the caller is way too
> intrusive: a simple count places the number of xstrerror calls at about 260.
> So we're back to square one, the -v2 patch. Do you see any other options?
> 

No sorry. But I do know that we also have to deal with CONTENT cotaining
nested functions etc. That means nested debugs() calls...

At debugs level 9 this is a big problem, particularly for things like
debugs in SBuf/String/MemBuf/MemAllocator methods that get triggered by
any object producing debug output for display.

Amos


More information about the squid-dev mailing list