Master: Protect against infinite recursion in locale_werror().

Master()->locale_werror() caused infinite recursion when the
call of main_resolve() triggered code that used werror().

An easy way to trigger the issue was to turn on the resolver debug
(like with eg -DMODULE_TRACE).
parent 4890f207
......@@ -6500,13 +6500,17 @@ protected void locale_werror(mixed ... args)
{
function werror = locale_werror_cache;
if (!werror) {
catch {
if (catch {
locale_werror_cache = Files()->_stderr->write;
object stderr = main_resolv( "Stdio.FILE" )( "stderr", "w" );
stderr->set_charset( 0 );
werror = stderr->write;
if (werror && !locale_werror_cache)
if (werror)
locale_werror_cache = werror;
};
}) {
werror = locale_werror_cache;
locale_werror_cache = UNDEFINED;
}
if (!werror)
werror = Files()->_stderr->write;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment