From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56150) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLWvP-00024N-Mp for qemu-devel@nongnu.org; Tue, 19 Jan 2016 09:06:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aLWvJ-0004DL-TH for qemu-devel@nongnu.org; Tue, 19 Jan 2016 09:06:23 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51639) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLWvJ-0004DC-OG for qemu-devel@nongnu.org; Tue, 19 Jan 2016 09:06:17 -0500 Date: Tue, 19 Jan 2016 14:06:11 +0000 From: "Daniel P. Berrange" Message-ID: <20160119140611.GM26662@redhat.com> References: <5525054B-A7E2-4538-9F68-9E606B85B1B7@gmail.com> <20160118095855.GC13395@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] CMSG_SPACE() causing compile time error on Mac OS X Reply-To: "Daniel P. Berrange" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Programmingkid Cc: Peter Maydell , qemu-devel qemu-devel , Paolo Bonzini 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 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 :|