On 06/13/2013 09:56 PM, Ján Tomko wrote:
Call virLogVMessage instead of virLogMessage, since libudev
called us with a va_list object, not a list of arguments.
Honor message priority and strip the trailing newline.
https://bugzilla.redhat.com/show_bug.cgi?id=969152
---
v1:
https://www.redhat.com/archives/libvir-list/2013-June/msg00349.html
v2: don't ignore priority and strip the trailing newline.
+typedef void (*udevLogFunctionPtr)(struct udev *udev,
+ int priority,
+ const char *file,
+ int line,
+ const char *fn,
+ const char *format,
+ va_list args);
+
+static void
+ATTRIBUTE_FMT_PRINTF(6,0)
+udevLogFunction(struct udev *udev ATTRIBUTE_UNUSED,
+ int priority,
+ const char *file,
+ int line,
+ const char *fn,
+ const char *fmt,
+ va_list args)
{
- VIR_ERROR_INT(VIR_LOG_FROM_LIBRARY, file, line, fn, fmt, args);
+ virBuffer buf = VIR_BUFFER_INITIALIZER;
+ const char *format = NULL;
+
+ virBufferAdd(&buf, fmt, -1);
+ virBufferTrim(&buf, "\n", -1);
+
We need a virBufferError checking here before formatting into
a string.
Others is good for me.
ACK with checking added here.
Guannan