diff options
| -rw-r--r-- | meta/recipes-multimedia/pulseaudio/pulseaudio/pulseaudio-discuss-iochannel-don-t-use-variable-length-array-in-union.patch | 59 | ||||
| -rw-r--r-- | meta/recipes-multimedia/pulseaudio/pulseaudio_10.0.bb | 1 |
2 files changed, 60 insertions, 0 deletions
diff --git a/meta/recipes-multimedia/pulseaudio/pulseaudio/pulseaudio-discuss-iochannel-don-t-use-variable-length-array-in-union.patch b/meta/recipes-multimedia/pulseaudio/pulseaudio/pulseaudio-discuss-iochannel-don-t-use-variable-length-array-in-union.patch new file mode 100644 index 0000000000..11b56abd26 --- /dev/null +++ b/meta/recipes-multimedia/pulseaudio/pulseaudio/pulseaudio-discuss-iochannel-don-t-use-variable-length-array-in-union.patch | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | From patchwork Sat Feb 4 12:19:01 2017 | ||
| 2 | Content-Type: text/plain; charset="utf-8" | ||
| 3 | MIME-Version: 1.0 | ||
| 4 | Content-Transfer-Encoding: 7bit | ||
| 5 | Subject: [pulseaudio-discuss] iochannel: don't use variable length array in | ||
| 6 | union | ||
| 7 | From: Tanu Kaskinen <tanuk@iki.fi> | ||
| 8 | X-Patchwork-Id: 136885 | ||
| 9 | Message-Id: <20170204121901.17428-1-tanuk@iki.fi> | ||
| 10 | To: pulseaudio-discuss@lists.freedesktop.org | ||
| 11 | Date: Sat, 4 Feb 2017 14:19:01 +0200 | ||
| 12 | |||
| 13 | Clang didn't like the variable length array: | ||
| 14 | |||
| 15 | pulsecore/iochannel.c:358:17: error: fields must have a constant size: | ||
| 16 | 'variable length array in structure' extension will never be supported | ||
| 17 | uint8_t data[CMSG_SPACE(sizeof(int) * nfd)]; | ||
| 18 | ^ | ||
| 19 | |||
| 20 | Commit 451d1d6762 introduced the variable length array in order to have | ||
| 21 | the correct value in msg_controllen. This patch reverts that commit and | ||
| 22 | uses a different way to achieve the same goal. | ||
| 23 | |||
| 24 | BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=99458 | ||
| 25 | --- | ||
| 26 | Upstream-Status: Backport | ||
| 27 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 28 | |||
| 29 | src/pulsecore/iochannel.c | 10 ++++++++-- | ||
| 30 | 1 file changed, 8 insertions(+), 2 deletions(-) | ||
| 31 | |||
| 32 | diff --git a/src/pulsecore/iochannel.c b/src/pulsecore/iochannel.c | ||
| 33 | index 8ace297ff..897337522 100644 | ||
| 34 | --- a/src/pulsecore/iochannel.c | ||
| 35 | +++ b/src/pulsecore/iochannel.c | ||
| 36 | @@ -355,7 +355,7 @@ ssize_t pa_iochannel_write_with_fds(pa_iochannel*io, const void*data, size_t l, | ||
| 37 | struct iovec iov; | ||
| 38 | union { | ||
| 39 | struct cmsghdr hdr; | ||
| 40 | - uint8_t data[CMSG_SPACE(sizeof(int) * nfd)]; | ||
| 41 | + uint8_t data[CMSG_SPACE(sizeof(int) * MAX_ANCIL_DATA_FDS)]; | ||
| 42 | } cmsg; | ||
| 43 | |||
| 44 | pa_assert(io); | ||
| 45 | @@ -382,7 +382,13 @@ ssize_t pa_iochannel_write_with_fds(pa_iochannel*io, const void*data, size_t l, | ||
| 46 | mh.msg_iov = &iov; | ||
| 47 | mh.msg_iovlen = 1; | ||
| 48 | mh.msg_control = &cmsg; | ||
| 49 | - mh.msg_controllen = sizeof(cmsg); | ||
| 50 | + | ||
| 51 | + /* If we followed the example on the cmsg man page, we'd use | ||
| 52 | + * sizeof(cmsg.data) here, but if nfd < MAX_ANCIL_DATA_FDS, then the data | ||
| 53 | + * buffer is larger than needed, and the kernel doesn't like it if we set | ||
| 54 | + * msg_controllen to a larger than necessary value. The commit message for | ||
| 55 | + * commit 451d1d6762 contains a longer explanation. */ | ||
| 56 | + mh.msg_controllen = CMSG_SPACE(sizeof(int) * nfd); | ||
| 57 | |||
| 58 | if ((r = sendmsg(io->ofd, &mh, MSG_NOSIGNAL)) >= 0) { | ||
| 59 | io->writable = io->hungup = false; | ||
diff --git a/meta/recipes-multimedia/pulseaudio/pulseaudio_10.0.bb b/meta/recipes-multimedia/pulseaudio/pulseaudio_10.0.bb index f3a85737fc..9a34afaa7e 100644 --- a/meta/recipes-multimedia/pulseaudio/pulseaudio_10.0.bb +++ b/meta/recipes-multimedia/pulseaudio/pulseaudio_10.0.bb | |||
| @@ -3,6 +3,7 @@ require pulseaudio.inc | |||
| 3 | SRC_URI = "http://freedesktop.org/software/pulseaudio/releases/${BP}.tar.xz \ | 3 | SRC_URI = "http://freedesktop.org/software/pulseaudio/releases/${BP}.tar.xz \ |
| 4 | file://0001-padsp-Make-it-compile-on-musl.patch \ | 4 | file://0001-padsp-Make-it-compile-on-musl.patch \ |
| 5 | file://0001-client-conf-Add-allow-autospawn-for-root.patch \ | 5 | file://0001-client-conf-Add-allow-autospawn-for-root.patch \ |
| 6 | file://pulseaudio-discuss-iochannel-don-t-use-variable-length-array-in-union.patch \ | ||
| 6 | file://volatiles.04_pulse \ | 7 | file://volatiles.04_pulse \ |
| 7 | " | 8 | " |
| 8 | SRC_URI[md5sum] = "4950d2799bf55ab91f6b7f990b7f0971" | 9 | SRC_URI[md5sum] = "4950d2799bf55ab91f6b7f990b7f0971" |
