From: Ben Pfaff Date: Thu, 7 Jan 2010 21:58:49 +0000 (-0800) Subject: stream-ssl: Fix ssl_recv() and ssl_send() return value semantics. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2b494771fdaa05eeea2c9789b36e455e46468d41;p=openvswitch stream-ssl: Fix ssl_recv() and ssl_send() return value semantics. These functions' return value semantics did not match those documented in stream-provider.h. --- diff --git a/lib/stream-ssl.c b/lib/stream-ssl.c index 436dc7b2..6839341c 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; } } }