]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
fd: only add valid fd to mainloop 3235/head
authordongxinhua <dongxinhua@huawei.com>
Sat, 21 Dec 2019 09:44:40 +0000 (17:44 +0800)
committerdongxinhua <dongxinhua@huawei.com>
Mon, 23 Dec 2019 08:45:36 +0000 (16:45 +0800)
Signed-off-by: dongxinhua <dongxinhua@huawei.com>
src/lxc/mainloop.c

index b169aa6fe2cd3f5fdcfe197d4cc00f31398b63a3..79b4fb747b22e3e73ecbce8f91b9776f8bda2091 100644 (file)
@@ -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)