[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] CMSG_SPACE() causing compile time error on Mac OS X
From: |
Programmingkid |
Subject: |
Re: [Qemu-devel] CMSG_SPACE() causing compile time error on Mac OS X |
Date: |
Mon, 18 Jan 2016 09:36:08 -0500 |
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;
>
>
>
> 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 :|
Your patch solves the problem. Good job!
Reviewed-By: John Arbuckle <address@hidden>
- Re: [Qemu-devel] CMSG_SPACE() causing compile time error on Mac OS X, (continued)
- Re: [Qemu-devel] CMSG_SPACE() causing compile time error on Mac OS X, Programmingkid, 2016/01/18
- Re: [Qemu-devel] CMSG_SPACE() causing compile time error on Mac OS X, Peter Maydell, 2016/01/18
- Re: [Qemu-devel] CMSG_SPACE() causing compile time error on Mac OS X, Programmingkid, 2016/01/18
- Re: [Qemu-devel] CMSG_SPACE() causing compile time error on Mac OS X, Peter Maydell, 2016/01/18
- Re: [Qemu-devel] CMSG_SPACE() causing compile time error on Mac OS X, Programmingkid, 2016/01/18
- Re: [Qemu-devel] CMSG_SPACE() causing compile time error on Mac OS X, Programmingkid, 2016/01/19
Re: [Qemu-devel] CMSG_SPACE() causing compile time error on Mac OS X, Daniel P. Berrange, 2016/01/18
- Re: [Qemu-devel] CMSG_SPACE() causing compile time error on Mac OS X,
Programmingkid <=