[Spice-devel] [PATCH spice-server 3/5] reds: Assume error if RedStreamSslStatus is not recognized

Frediano Ziglio fziglio at redhat.com
Tue Oct 9 08:30:04 UTC 2018


Make code safer in case the enumeration is extended in the future.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/reds.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/server/reds.c b/server/reds.c
index ec9f9258..5c2e8cb0 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -2357,6 +2357,7 @@ static void reds_handle_ssl_accept(int fd, int event, void *data)
     RedStreamSslStatus return_code = red_stream_ssl_accept(link->stream);
 
     switch (return_code) {
+        default:
         case RED_STREAM_SSL_STATUS_ERROR:
             reds_link_free(link);
             return;
@@ -2422,6 +2423,7 @@ static RedLinkInfo *reds_init_client_ssl_connection(RedsState *reds, int socket)
         case RED_STREAM_SSL_STATUS_OK:
             reds_handle_new_link(link);
             return link;
+        default:
         case RED_STREAM_SSL_STATUS_ERROR:
             goto error;
         case RED_STREAM_SSL_STATUS_WAIT_FOR_READ:
-- 
2.17.1



More information about the Spice-devel mailing list