From d830185df9ab61cf4cbc4f380fbdff43880adcac Mon Sep 17 00:00:00 2001 From: Andy Green Date: Fri, 6 Apr 2018 11:29:35 +0800 Subject: [PATCH] coverity 189197: workaround false cov detect There's nothing wrong with ignoring the ringbuf filling. But coverity infers there is because elsewhere under other circumstances we report it. --- test-apps/test-sshd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test-apps/test-sshd.c b/test-apps/test-sshd.c index b3c4da3e..15984537 100644 --- a/test-apps/test-sshd.c +++ b/test-apps/test-sshd.c @@ -205,7 +205,8 @@ ssh_ops_rx(void *_priv, struct lws *wsi, const uint8_t *buf, uint32_t len) if (write(fd, buf, len) != len) return -1; if (priv->pty_in_echo) { - lws_ring_insert(priv->ring_stdout, buf, 1); + if (!lws_ring_insert(priv->ring_stdout, buf, 1)) + lwsl_notice("dropping...\n"); lws_callback_on_writable(wsi); } } else { @@ -217,7 +218,8 @@ ssh_ops_rx(void *_priv, struct lws *wsi, const uint8_t *buf, uint32_t len) if (priv->pty_in_echo) { bbuf[0] = 0x0d; bbuf[1] = 0x0a; - lws_ring_insert(priv->ring_stdout, bbuf, 2); + if (!lws_ring_insert(priv->ring_stdout, bbuf, 2)) + lwsl_notice("dropping...\n"); lws_callback_on_writable(wsi); } }