[lxc-devel] [lxc/master] fd: only add valid fd to mainloop

xinhua9569 on Github lxc-bot at linuxcontainers.org
Sat Dec 21 09:50:28 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 350 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20191221/a58f9617/attachment.bin>
-------------- next part --------------
From c62e88dd54bdb4e9f74642c716ca720313adda41 Mon Sep 17 00:00:00 2001
From: dongxinhua <dongxinhua at huawei.com>
Date: Sat, 21 Dec 2019 17:44:40 +0800
Subject: [PATCH] fd: only add valid fd to mainloop

Signed-off-by: dongxinhua <dongxinhua at huawei.com>
---
 src/lxc/mainloop.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/lxc/mainloop.c b/src/lxc/mainloop.c
index b169aa6fe2..30ce624045 100644
--- a/src/lxc/mainloop.c
+++ b/src/lxc/mainloop.c
@@ -84,6 +84,8 @@ int lxc_mainloop_add_handler(struct lxc_epoll_descr *descr, int fd,
 	struct epoll_event ev;
 	struct mainloop_handler *handler;
 	struct lxc_list *item;
+	if (fd < 0)
+		return 0;
 
 	handler = malloc(sizeof(*handler));
 	if (!handler)


More information about the lxc-devel mailing list