[ovs-dev] [PATCH 5/7] stream-ssl: Fix ssl_recv() and ssl_send() return value semantics.

Justin Pettit jpettit at nicira.com
Thu Jan 7 23:56:43 UTC 2010


Looks good.

--Justin


On Jan 7, 2010, at 3:01 PM, Ben Pfaff wrote:

> These functions' return value semantics did not match those documented
> in stream-provider.h.
> ---
> lib/stream-ssl.c |   11 ++++++-----
> 1 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/lib/stream-ssl.c b/lib/stream-ssl.c
> index 436dc7b..6839341 100644
> --- a/lib/stream-ssl.c
> +++ b/lib/stream-ssl.c
> @@ -549,7 +549,8 @@ ssl_recv(struct stream *stream, void *buffer, size_t n)
>         if (error == SSL_ERROR_ZERO_RETURN) {
>             return 0;
>         } else {
> -            return interpret_ssl_error("SSL_read", ret, error, &sslv->rx_want);
> +            return -interpret_ssl_error("SSL_read", ret, error,
> +                                        &sslv->rx_want);
>         }
>     }
> }
> @@ -597,7 +598,7 @@ ssl_send(struct stream *stream, const void *buffer, size_t n)
>     struct ssl_stream *sslv = ssl_stream_cast(stream);
> 
>     if (sslv->txbuf) {
> -        return EAGAIN;
> +        return -EAGAIN;
>     } else {
>         int error;
> 
> @@ -606,13 +607,13 @@ ssl_send(struct stream *stream, const void *buffer, size_t n)
>         switch (error) {
>         case 0:
>             ssl_clear_txbuf(sslv);
> -            return 0;
> +            return n;
>         case EAGAIN:
>             leak_checker_claim(buffer);
> -            return 0;
> +            return n;
>         default:
>             sslv->txbuf = NULL;
> -            return error;
> +            return -error;
>         }
>     }
> }
> -- 
> 1.6.3.3
> 
> 
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev_openvswitch.org





More information about the dev mailing list