Tarantool development patches archive
 help / color / mirror / Atom feed
* [PATCH 1/1] box: add error description
@ 2019-01-09 16:57 imeevma
  2019-01-10 15:41 ` Vladimir Davydov
  0 siblings, 1 reply; 2+ messages in thread
From: imeevma @ 2019-01-09 16:57 UTC (permalink / raw)
  To: tarantool-patches, vdavydov.dev

This patch adds a description to the error that occurs when
obuf_alloc() fails in box/port.c.
---

https://github.com/tarantool/tarantool/tree/imeevma/add-error-description

 src/box/port.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/box/port.c b/src/box/port.c
index ef511ea..9904644 100644
--- a/src/box/port.c
+++ b/src/box/port.c
@@ -113,8 +113,11 @@ port_tuple_dump_msgpack(struct port *base, struct obuf *out)
 {
 	struct port_tuple *port = port_tuple(base);
 	char *size_buf = obuf_alloc(out, mp_sizeof_array(port->size));
-	if (size_buf == NULL)
+	if (size_buf == NULL) {
+		diag_set(OutOfMemory, mp_sizeof_array(port->size), "obuf_alloc",
+			 "size_buf");
 		return -1;
+	}
 	mp_encode_array(size_buf, port->size);
 	if (port_tuple_dump_msgpack_16(base, out) < 0)
 		return -1;
-- 
2.7.4

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] box: add error description
  2019-01-09 16:57 [PATCH 1/1] box: add error description imeevma
@ 2019-01-10 15:41 ` Vladimir Davydov
  0 siblings, 0 replies; 2+ messages in thread
From: Vladimir Davydov @ 2019-01-10 15:41 UTC (permalink / raw)
  To: imeevma; +Cc: tarantool-patches

On Wed, Jan 09, 2019 at 07:57:05PM +0300, imeevma@tarantool.org wrote:
> This patch adds a description to the error that occurs when
> obuf_alloc() fails in box/port.c.

Changed the comment to

    box: add missing diag_set to port_tuple_dump_msgpack

    Not really critical as obuf_alloc() fails only on OOM, i.e. never in
    practice.

and pushed it to 2.1.

> ---
> 
> https://github.com/tarantool/tarantool/tree/imeevma/add-error-description
> 
>  src/box/port.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/src/box/port.c b/src/box/port.c
> index ef511ea..9904644 100644
> --- a/src/box/port.c
> +++ b/src/box/port.c
> @@ -113,8 +113,11 @@ port_tuple_dump_msgpack(struct port *base, struct obuf *out)
>  {
>  	struct port_tuple *port = port_tuple(base);
>  	char *size_buf = obuf_alloc(out, mp_sizeof_array(port->size));
> -	if (size_buf == NULL)
> +	if (size_buf == NULL) {
> +		diag_set(OutOfMemory, mp_sizeof_array(port->size), "obuf_alloc",
> +			 "size_buf");
>  		return -1;
> +	}
>  	mp_encode_array(size_buf, port->size);
>  	if (port_tuple_dump_msgpack_16(base, out) < 0)
>  		return -1;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-01-10 15:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-09 16:57 [PATCH 1/1] box: add error description imeevma
2019-01-10 15:41 ` Vladimir Davydov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox