VIR_ERROR_INT calls virLogMessage(..., const char *fmt, ...). Call virLogVMessage(..., const char *fmt, va_list list) instead, since libudev called us with a va_list object, not a list of arguments. https://bugzilla.redhat.com/show_bug.cgi?id=969152 --- Without the cast, I was getting: node_device/node_device_udev.c: In function 'nodeStateInitialize': node_device/node_device_udev.c:1684:5: error: argument 2 of 'udev_set_log_fn' might be a candidate for a format attribute [-Werror=missing-format-attribute] node_device/node_device_udev.c: At top level: cc1: error: unrecognized command line option "-Wno-unused-command-line-argument" [-Werror] Is there a nicer way to get rid of it? src/libvirt_private.syms | 1 + src/node_device/node_device_udev.c | 30 +++++++++++++++++++++--------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index b93629f..d73a4d0 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1486,6 +1486,7 @@ virLogSetBufferSize; virLogSetDefaultPriority; virLogSetFromEnv; virLogUnlock; +virLogVMessage; # util/virmacaddr.h diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c index 620cd58..ffcae16 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -348,15 +348,26 @@ static int udevGenerateDeviceName(struct udev_device *device, } -static void udevLogFunction(struct udev *udev ATTRIBUTE_UNUSED, - int priority ATTRIBUTE_UNUSED, - const char *file, - int line, - const char *fn, - const char *fmt, - va_list args) +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 ATTRIBUTE_UNUSED, + 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); + virLogVMessage(VIR_LOG_FROM_LIBRARY, VIR_LOG_ERROR, + file, line, fn, NULL, fmt, args); } @@ -1672,7 +1683,8 @@ static int nodeStateInitialize(bool privileged ATTRIBUTE_UNUSED, * its return value. */ udev = udev_new(); - udev_set_log_fn(udev, udevLogFunction); + /* cast to get rid of missing-format-attribute warning */ + udev_set_log_fn(udev, (udevLogFunctionPtr) udevLogFunction); priv->udev_monitor = udev_monitor_new_from_netlink(udev, "udev"); if (priv->udev_monitor == NULL) { -- 1.8.1.5 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list