[Spice-devel] [PATCH spice-server 3/5] reds: Assume error if RedStreamSslStatus is not recognized
Frediano Ziglio
fziglio at redhat.com
Tue Oct 9 11:49:42 UTC 2018
> On Tue, Oct 09, 2018 at 09:30:04AM +0100, Frediano Ziglio wrote:
> > Make code safer in case the enumeration is extended in the future.
>
> Without default:, the compiler should give you a compile-time warning
> that you don't handle all cases. With default:, the warning is going to
> be silenced, and we won't be able to catch this early. So I would not
> add it.
>
> Christophe
>
Yes, I suppose so. So is this an ack for 2/5 ?
Frediano
> >
> > 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:
More information about the Spice-devel
mailing list