[libvirt] [PATCH] lxc: detect socket failure
Jim Meyering
jim at meyering.net
Tue Mar 2 17:24:27 UTC 2010
Eric Blake wrote:
> Coverity warned about a potential close(-1).
>
> * src/lxc/lxc_controller.c (lxcControllerMain): React to failure
> to accept.
> ---
> src/lxc/lxc_controller.c | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
> index 95970cc..318106e 100644
> --- a/src/lxc/lxc_controller.c
> +++ b/src/lxc/lxc_controller.c
> @@ -1,5 +1,6 @@
> /*
> + * Copyright (C) 2010 Red Hat, Inc.
> * Copyright IBM Corp. 2008
> *
> * lxc_controller.c: linux container process controller
> *
> @@ -348,8 +349,13 @@ static int lxcControllerMain(int monitor,
> numEvents = epoll_wait(epollFd, &epollEvent, 1, timeout);
> if (numEvents > 0) {
> if (epollEvent.data.fd == monitor) {
> int fd = accept(monitor, NULL, 0);
> + if (fd < 0) {
> + virReportSystemError(errno, "%s",
> + _("epoll_ctl(client) failed"));
> + goto cleanup;
> + }
> if (client != -1) { /* Already connected, so kick new one out */
> close(fd);
> continue;
> }
I proposed an identical patch.
Follow-up discussion petered out, though...
http://thread.gmane.org/gmane.comp.emulators.libvirt/20607
More information about the libvir-list
mailing list