From: Peter Krempa Date: Thu, 14 Apr 2016 07:04:52 +0000 (+0200) Subject: event-test: Force compiler check in switch for connectClose callback X-Git-Tag: v1.3.4-rc1~160 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=09ddd86027db95448624139691341c2814d4ccd1;p=thirdparty%2Flibvirt.git event-test: Force compiler check in switch for connectClose callback --- diff --git a/examples/object-events/event-test.c b/examples/object-events/event-test.c index 68a571b8ed..22bd706d03 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"); }