diff options
author | Daniel P. Berrange <berrange@redhat.com> | 2011-03-29 11:26:55 +0100 |
---|---|---|
committer | Daniel P. Berrange <berrange@redhat.com> | 2011-03-31 16:01:49 +0100 |
commit | 242195425c03779ef42059e72a92f0e0be7c46cb (patch) | |
tree | 496eb3afded0d8de7ba7e2534d6a71e87a8aac9f /examples | |
parent | maint: avoid locale-sensitivity in string case comparisons (diff) | |
download | libvirt-242195425c03779ef42059e72a92f0e0be7c46cb.tar.gz libvirt-242195425c03779ef42059e72a92f0e0be7c46cb.tar.bz2 libvirt-242195425c03779ef42059e72a92f0e0be7c46cb.zip |
Fix domain events C example on Win32
printf on Win32 does not necessarily support %lld and we don't
have GNULIBs wrapper for printf(). Switch to use asprintf() for
which we do have a gnulib wrapper with %lld support
* examples/domain-events/events-c/event-test.c: Fix formatting
of %lld on Win32
* cfg.mk: Don't require use of virAsprintf since this is an
example app for out of tree users to follow
Diffstat (limited to 'examples')
-rw-r--r-- | examples/domain-events/events-c/event-test.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/examples/domain-events/events-c/event-test.c b/examples/domain-events/events-c/event-test.c index 7d05dd83d..1f46d42a2 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; } |