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

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

 



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

> 
> Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> ---
>  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
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/spice-devel

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]