[libvirt] Re: libvirt code review

Daniel Veillard veillard at redhat.com
Tue Nov 10 16:55:24 UTC 2009


On Tue, Nov 10, 2009 at 01:00:36PM +0100, Daniel Veillard wrote:
> On Thu, Nov 05, 2009 at 01:12:41PM -0500, Steve Grubb wrote:
> > In src/qemu/qemu_monitor_text.c at line 178, a variable, control, is assigned 
> > to a member of the msg structure. However, control goes out of scope before 
> > its used. It should be in the function level declarations.
> 
>   Ah right, nasty !
[...]
> diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
> index 35cd330..ab1fb9a 100644
> --- a/src/qemu/qemu_monitor_text.c
> +++ b/src/qemu/qemu_monitor_text.c
> @@ -159,6 +159,7 @@ qemuMonitorSendUnix(const virDomainObjPtr vm,
>                      size_t cmdlen,
>                      int scm_fd)
>  {
> +    char control[CMSG_SPACE(sizeof(int))];
>      struct msghdr msg;
>      struct iovec iov[1];
>      ssize_t ret;
> @@ -172,7 +173,6 @@ qemuMonitorSendUnix(const virDomainObjPtr vm,
>      msg.msg_iovlen = 1;
>  
>      if (scm_fd != -1) {
> -        char control[CMSG_SPACE(sizeof(int))];
>          struct cmsghdr *cmsg;
>  
>          msg.msg_control = control;

  Actually that patch disapears after Dan last commits, as the function
  is refactored, uses qemuMonitorIOWriteWithFD() where the issue is
  fixed.

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list