qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: Programmingkid <programmingkidx@gmail.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	qemu-devel qemu-devel <qemu-devel@nongnu.org>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] CMSG_SPACE() causing compile time error on Mac OS X
Date: Tue, 19 Jan 2016 14:06:11 +0000	[thread overview]
Message-ID: <20160119140611.GM26662@redhat.com> (raw)
In-Reply-To: <A7B930B0-E58A-4D83-ACAE-173384388067@gmail.com>

On Mon, Jan 18, 2016 at 09:36:08AM -0500, Programmingkid wrote:
> 
> On Jan 18, 2016, at 4:58 AM, Daniel P. Berrange wrote:
> 
> > On Sun, Jan 17, 2016 at 05:23:44PM -0500, Programmingkid wrote:
> >> I was wondering if you had problems compiling QEMU on Mac OS X recently. On my system, the channel-socket.c file causes this error:
> >> 
> >> io/channel-socket.c: In function 'qio_channel_socket_writev':
> >> io/channel-socket.c:497:18: error: variable-sized object may not be initialized
> >>     char control[CMSG_SPACE(sizeof(int) * SOCKET_MAX_FDS)] = { 0 };
> > 
> > Can you try applying this patch:
> > 
> > diff --git a/io/channel-socket.c b/io/channel-socket.c
> > index eaa411f..bc117b1 100644
> > --- a/io/channel-socket.c
> > +++ b/io/channel-socket.c
> > @@ -493,10 +495,12 @@ static ssize_t qio_channel_socket_writev(QIOChannel *ioc,
> >     QIOChannelSocket *sioc = QIO_CHANNEL_SOCKET(ioc);
> >     ssize_t ret;
> >     struct msghdr msg = { NULL, };
> > -    char control[CMSG_SPACE(sizeof(int) * SOCKET_MAX_FDS)] = { 0 };
> > +    char control[CMSG_SPACE(sizeof(int) * SOCKET_MAX_FDS)];
> >     size_t fdsize = sizeof(int) * nfds;
> >     struct cmsghdr *cmsg;
> > 
> > +    memset(control, 0, CMSG_SPACE(sizeof(int) * SOCKET_MAX_FDS));
> > +
> >     msg.msg_iov = (struct iovec *)iov;
> >     msg.msg_iovlen = niov;
> > 
> 
> Your patch solves the problem. Good job!
> 
> Reviewed-By: John Arbuckle <programmingkidx@gmail.com>

Thanks, I'll include this fix in my next PULL request for the io/ layer

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

      reply	other threads:[~2016-01-19 14:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-17 22:23 [Qemu-devel] CMSG_SPACE() causing compile time error on Mac OS X Programmingkid
2016-01-17 23:22 ` Paolo Bonzini
2016-01-17 23:45   ` Programmingkid
2016-01-18 17:45     ` Eric Blake
2016-01-18 17:59       ` Peter Maydell
2016-01-18 19:46         ` Programmingkid
2016-01-18 19:50       ` Programmingkid
2016-01-18 20:49         ` Peter Maydell
2016-01-18 21:09           ` Programmingkid
2016-01-18 22:09             ` Peter Maydell
2016-01-19  1:23               ` Programmingkid
2016-01-19 23:49                 ` Programmingkid
2016-01-18  9:58 ` Daniel P. Berrange
2016-01-18 14:36   ` Programmingkid
2016-01-19 14:06     ` Daniel P. Berrange [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160119140611.GM26662@redhat.com \
    --to=berrange@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=programmingkidx@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).