[PATCH] event-test: Properly terminate strings printed from callbacks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Stdio was buffering strings in functions:
myDomainEventBlockJobCallback,
myDomainEventBlockThresholdCallback,
myDomainEventMemoryFailureCallback. It caused flushing the
printed strings from callbacks at the end of a run, not
gradually. The solution is to add \n at the end of each string.

Signed-off-by: Kristina Hanicova <khanicov@xxxxxxxxxx>
---
 examples/c/misc/event-test.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/examples/c/misc/event-test.c b/examples/c/misc/event-test.c
index f164e825e1..76d4f3f6e8 100644
--- a/examples/c/misc/event-test.c
+++ b/examples/c/misc/event-test.c
@@ -938,7 +938,7 @@ myDomainEventBlockJobCallback(virConnectPtr conn G_GNUC_UNUSED,
     const char *eventName = opaque;
 
     printf("%s EVENT: Domain %s(%d) block job callback '%s' disk '%s', "
-           "type '%s' status '%s'",
+           "type '%s' status '%s'\n",
            __func__, virDomainGetName(dom), virDomainGetID(dom), eventName,
            disk, blockJobTypeToStr(type), blockJobStatusToStr(status));
     return 0;
@@ -956,7 +956,7 @@ myDomainEventBlockThresholdCallback(virConnectPtr conn G_GNUC_UNUSED,
 {
     /* Casts to uint64_t to work around mingw not knowing %lld */
     printf("%s EVENT: Domain %s(%d) block threshold callback dev '%s'(%s), "
-           "threshold: '%" PRIu64 "', excess: '%" PRIu64 "'",
+           "threshold: '%" PRIu64 "', excess: '%" PRIu64 "'\n",
            __func__, virDomainGetName(dom), virDomainGetID(dom),
            dev, NULLSTR(path), (uint64_t)threshold, (uint64_t)excess);
     return 0;
@@ -972,7 +972,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'", __func__, virDomainGetName(dom),
+           "aciont '%d', flags '%d'\n", __func__, virDomainGetName(dom),
            virDomainGetID(dom), recipient, action, flags);
     return 0;
 }
-- 
2.29.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux