From: Adrian Frances <adrian.fran...@netduma.com>

According to man 7 unix, sendmsg returns EBADF when sending an
invalid file descriptor as ancillary data. The patch avois ubus
disconnecting the client when EBADF is received for the mentioned
case.

Signed-off-by: Adrian Frances <adrian.fran...@netduma.com>
---
 ubusd_main.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/ubusd_main.c b/ubusd_main.c
index d454b1a..8a043b7 100644
--- a/ubusd_main.c
+++ b/ubusd_main.c
@@ -67,6 +67,12 @@ static void client_cb(struct uloop_fd *sock, unsigned int 
events)
                        case EINTR:
                        case EAGAIN:
                                break;
+                       case EBADF:
+                               if(fcntl(sock->fd, F_GETFD) != -1) {
+                                       cl->txq_ofs = 0;
+                                       ubus_msg_dequeue(cl);
+                                       continue;
+                               }
                        default:
                                goto disconnect;
                        }
-- 
2.25.1


_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to