]> xenbits.xensource.com Git - libvirt.git/commitdiff
event-test: Force compiler check in switch for connectClose callback
authorPeter Krempa <pkrempa@redhat.com>
Thu, 14 Apr 2016 07:04:52 +0000 (09:04 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 18 Apr 2016 14:31:28 +0000 (16:31 +0200)
examples/object-events/event-test.c

index 68a571b8ed9feffa4b00b6f746b3f4c62798556f..22bd706d03fda9927a04c6fe46f77538650c509c 100644 (file)
@@ -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");
 }