Received: from eggs.gnu.org ([2001:4830:134:3::10]:38649) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLAum-0001c6-1e for qemu-devel@nongnu.org; Mon, 18 Jan 2016 09:36:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aLAui-0000VM-9l for qemu-devel@nongnu.org; Mon, 18 Jan 2016 09:36:15 -0500 Received: from mail-ig0-x22f.google.com ([2607:f8b0:4001:c05::22f]:36841) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLAui-0000VH-4A for qemu-devel@nongnu.org; Mon, 18 Jan 2016 09:36:12 -0500 Received: by mail-ig0-x22f.google.com with SMTP id z14so56550562igp.1 for ; Mon, 18 Jan 2016 06:36:12 -0800 (PST) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Programmingkid In-Reply-To: <20160118095855.GC13395@redhat.com> Date: Mon, 18 Jan 2016 09:36:08 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: References: <5525054B-A7E2-4538-9F68-9E606B85B1B7@gmail.com> <20160118095855.GC13395@redhat.com> Subject: Re: [Qemu-devel] CMSG_SPACE() causing compile time error on Mac OS X List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" Cc: Peter Maydell , qemu-devel qemu-devel , Paolo Bonzini 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: >>=20 >> 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)] =3D { 0 }; >=20 > Can you try applying this patch: >=20 > 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 =3D QIO_CHANNEL_SOCKET(ioc); > ssize_t ret; > struct msghdr msg =3D { NULL, }; > - char control[CMSG_SPACE(sizeof(int) * SOCKET_MAX_FDS)] =3D { 0 }; > + char control[CMSG_SPACE(sizeof(int) * SOCKET_MAX_FDS)]; > size_t fdsize =3D sizeof(int) * nfds; > struct cmsghdr *cmsg; >=20 > + memset(control, 0, CMSG_SPACE(sizeof(int) * SOCKET_MAX_FDS)); > + > msg.msg_iov =3D (struct iovec *)iov; > msg.msg_iovlen =3D niov; >=20 >=20 >=20 > Regards, > Daniel > --=20 > |: 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 :| Your patch solves the problem. Good job! Reviewed-By: John Arbuckle