From: dongxinhua Date: Sat, 21 Dec 2019 09:44:40 +0000 (+0800) Subject: fd: only add valid fd to mainloop X-Git-Tag: lxc-4.0.0~69^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4879faffbfab680dd8fa2ce6bf47849b83926e0c;p=thirdparty%2Flxc.git fd: only add valid fd to mainloop Signed-off-by: dongxinhua --- diff --git a/src/lxc/mainloop.c b/src/lxc/mainloop.c index b169aa6fe..79b4fb747 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 -1; handler = malloc(sizeof(*handler)); if (!handler)