Re: [libvirt] [PATCH] lxc: detect socket failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]