Stuart Henderson:

> Perhaps by calling a different function instead of v*printf that does
> most of the same things except not syslogging for null %s prints..

Well... glib2's configure checks for vasprintf() and vsnprintf()
and can fall back to an included copy of gnulib's implementation
of those functions.

If I understand the gnulib code correctly, it doesn't actually
reimplement the *printf() family, but works as a wrapper that breaks
down some functionality and still calls basic system *printf()
functions.  I also can't find any special handling of NULL arguments
for the %s format.  So I think forcing glib to use the gnulib
implementation will not solve this problem by itself.

However, the gnulib functions call an internal printf_parse() routine
that analyzes the format string and digests it into arrays of
directives and corresponding arguments.  This looks like the spot
where an argument for %s could be checked for NULL and swapped out
with a pointer to the string constant "(null)".

Assuming we manage to hack up the g_log() backend as outlined above,
what's next?  With the most common source of those log messages
removed, the second most common one will become apparent...

I question our wisdom of having printf() log instances of %s NULL,
but then declaring that we can't fix the offenders and need to
resort to intercepting arguments passed to printf().

-- 
Christian "naddy" Weisgerber                          na...@mips.inka.de

Reply via email to