Glib->log() and %-style format strings



Aloha,

this always produces a segmentation fault on my machine:

  perl -MGlib -e'Glib->log(q/Test/, qw/warning/, q(%s %s));'

The reason is that we pass the message string ("%s %s" in this case) unaltered down to g_log():

  g_log (log_domain, SvGLogLevelFlags (log_level), message);

g_log() then inspects it for %-style format strings. As it sees two %s, it looks for two additional arguments, but there are none.

Does anyone know how to reliably prevent this? How can we tell g_log() or maybe g_logv() that there are no further arguments and that any %-style string should be left alone?

-Torsten



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]