From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52249) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aL6aV-0001m4-B6 for qemu-devel@nongnu.org; Mon, 18 Jan 2016 04:59:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aL6aS-0004dB-44 for qemu-devel@nongnu.org; Mon, 18 Jan 2016 04:59:03 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57207) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aL6aR-0004cd-Uf for qemu-devel@nongnu.org; Mon, 18 Jan 2016 04:59:00 -0500 Date: Mon, 18 Jan 2016 09:58:55 +0000 From: "Daniel P. Berrange" Message-ID: <20160118095855.GC13395@redhat.com> References: <5525054B-A7E2-4538-9F68-9E606B85B1B7@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <5525054B-A7E2-4538-9F68-9E606B85B1B7@gmail.com> 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 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; 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 :|