diff --git a/cfg.mk b/cfg.mk index f802cee494a231b883266a0d975b0d1580f929a0..4ed0d96febd78927b0205492d6d944a50fd27e87 100644 --- a/cfg.mk +++ b/cfg.mk @@ -571,7 +571,7 @@ exclude_file_name_regexp--sc_prohibit_always_true_header_tests = \ (^docs|^python/(libvirt-override|typewrappers)\.c$$) exclude_file_name_regexp--sc_prohibit_asprintf = \ - ^(bootstrap.conf$$|po/|src/util/util\.c$$) + ^(bootstrap.conf$$|po/|src/util/util\.c$$|examples/domain-events/events-c/event-test\.c$$) exclude_file_name_regexp--sc_prohibit_close = \ (\.py$$|^docs/|(src/util/files\.c|src/libvirt\.c)$$) diff --git a/examples/domain-events/events-c/event-test.c b/examples/domain-events/events-c/event-test.c index 7d05dd83d7b36ad55a105bb303edfa489ca088ed..1f46d42a2179b09343d5a15083962200349a87ff 100644 --- a/examples/domain-events/events-c/event-test.c +++ b/examples/domain-events/events-c/event-test.c @@ -169,8 +169,16 @@ static int myDomainEventRTCChangeCallback(virConnectPtr conn ATTRIBUTE_UNUSED, long long offset, void *opaque ATTRIBUTE_UNUSED) { - printf("%s EVENT: Domain %s(%d) rtc change %lld\n", __func__, virDomainGetName(dom), - virDomainGetID(dom), offset); + char *str = NULL; + /* HACK: use asprintf since we have gnulib's wrapper for %lld on Win32 + * but don't have a printf() replacement with %lld */ + if (asprintf(&str, "%s EVENT: Domain %s(%d) rtc change %lld\n", + __func__, virDomainGetName(dom), + virDomainGetID(dom), offset) < 0) + return 0; + + printf("%s", str); + free(str); return 0; }