[Top][All Lists]

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

[PATCH] char: don't fail when client is not connected

From: Pavel Dovgalyuk
Subject: [PATCH] char: don't fail when client is not connected
Date: Tue, 02 Feb 2021 10:08:31 +0300
User-agent: StGit/0.23

This patch checks that ioc is not null before
using it in tcp socket tcp_chr_add_watch function.

Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
 chardev/char-socket.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/chardev/char-socket.c b/chardev/char-socket.c
index 213a4c8dd0..cef1d9438f 100644
--- a/chardev/char-socket.c
+++ b/chardev/char-socket.c
@@ -385,6 +385,9 @@ static ssize_t tcp_chr_recv(Chardev *chr, char *buf, size_t 
 static GSource *tcp_chr_add_watch(Chardev *chr, GIOCondition cond)
     SocketChardev *s = SOCKET_CHARDEV(chr);
+    if (!s->ioc) {
+        return NULL;
+    }
     return qio_channel_create_watch(s->ioc, cond);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]