[PATCH 07/18] event-test: Force compiler check in switch for connectClose callback

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

 



---
 examples/object-events/event-test.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/examples/object-events/event-test.c b/examples/object-events/event-test.c
index 68a571b..22bd706 100644
--- a/examples/object-events/event-test.c
+++ b/examples/object-events/event-test.c
@@ -23,24 +23,27 @@ connectClose(virConnectPtr conn ATTRIBUTE_UNUSED,
              int reason,
              void *opaque ATTRIBUTE_UNUSED)
 {
-    switch (reason) {
+    run = 0;
+
+    switch ((virConnectCloseReason) reason) {
     case VIR_CONNECT_CLOSE_REASON_ERROR:
         fprintf(stderr, "Connection closed due to I/O error\n");
-        break;
+        return;
+
     case VIR_CONNECT_CLOSE_REASON_EOF:
         fprintf(stderr, "Connection closed due to end of file\n");
-        break;
+        return;
+
     case VIR_CONNECT_CLOSE_REASON_KEEPALIVE:
         fprintf(stderr, "Connection closed due to keepalive timeout\n");
-        break;
+        return;
+
     case VIR_CONNECT_CLOSE_REASON_CLIENT:
         fprintf(stderr, "Connection closed due to client request\n");
-        break;
-    default:
-        fprintf(stderr, "Connection closed due to unknown reason\n");
-        break;
+        return;
     };
-    run = 0;
+
+    fprintf(stderr, "Connection closed due to unknown reason\n");
 }


-- 
2.8.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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]