[PATCH] fix error in printf format string

use '%u' to printf unsigned int Signed-off-by: zhujun2 <zhujun2@cmss.chinamobile.com> --- examples/c/misc/event-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/c/misc/event-test.c b/examples/c/misc/event-test.c index 813bca2699..07d86500cd 100644 --- a/examples/c/misc/event-test.c +++ b/examples/c/misc/event-test.c @@ -969,7 +969,7 @@ myDomainEventMemoryFailureCallback(virConnectPtr conn G_GNUC_UNUSED, void *opaque G_GNUC_UNUSED) { printf("%s EVENT: Domain %s(%d) memory failure: recipient '%d', " - "aciont '%d', flags '%d'\n", __func__, virDomainGetName(dom), + "aciont '%d', flags '%u'\n", __func__, virDomainGetName(dom), virDomainGetID(dom), recipient, action, flags); return 0; } -- 2.17.1

On 10/17/23 08:43, zhujun2 wrote:
use '%u' to printf unsigned int
The commit subject and the body too are not very descriptive. If I were to look at git log in a month or two I would have no idea what this commit does.
Signed-off-by: zhujun2 <zhujun2@cmss.chinamobile.com> --- examples/c/misc/event-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/examples/c/misc/event-test.c b/examples/c/misc/event-test.c index 813bca2699..07d86500cd 100644 --- a/examples/c/misc/event-test.c +++ b/examples/c/misc/event-test.c @@ -969,7 +969,7 @@ myDomainEventMemoryFailureCallback(virConnectPtr conn G_GNUC_UNUSED, void *opaque G_GNUC_UNUSED) { printf("%s EVENT: Domain %s(%d) memory failure: recipient '%d', " - "aciont '%d', flags '%d'\n", __func__, virDomainGetName(dom), + "aciont '%d', flags '%u'\n", __func__, virDomainGetName(dom),
We tend to print flags in a hexadecimal format: 0x%x because they are not really a number rather than bit mask.
virDomainGetID(dom), recipient, action, flags); return 0; }
I've fixed both commit message and the format and merged. Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Congratulations on your first libvirt contribution! Michal
participants (2)
-
Michal Prívozník
-
zhujun2