[v2] connection: Fix sendmsg() on FreeBSD

Submitted by Philip Withnall on Nov. 3, 2014, 9:49 a.m.

Details

Message ID 1415008143.22927.1.camel@philip-work-laptop.cbg.collabora.co.uk
State Accepted
Commit cb00e27039d3b1b4475150b2468066adb99984dc
Headers show

Not browsing as part of any series.

Commit Message

Philip Withnall Nov. 3, 2014, 9:49 a.m.
It expects ((msg_controllen == 0) == (msg_control == NULL)), and returns
EINVAL otherwise. It can't hurt to be tidy about things on other platforms
either though.

See: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=99356#c5

Signed-off-by: Philip Withnall <philip at tecnocode.co.uk>
Signed-off-by: Karsten Otto <ottoka at posteo.de>
---
Updated as per Bill Spitzak’s recommendation to make the change more concise.
---
 src/connection.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/src/connection.c b/src/connection.c
index f292853..1e271c4 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -287,7 +287,7 @@  wl_connection_flush(struct wl_connection *connection)
 		msg.msg_namelen = 0;
 		msg.msg_iov = iov;
 		msg.msg_iovlen = count;
-		msg.msg_control = cmsg;
+		msg.msg_control = (clen > 0) ? cmsg : NULL;
 		msg.msg_controllen = clen;
 		msg.msg_flags = 0;
 

Comments

On Mon, 03 Nov 2014 09:49:03 +0000
Philip Withnall <philip@tecnocode.co.uk> wrote:

> It expects ((msg_controllen == 0) == (msg_control == NULL)), and returns
> EINVAL otherwise. It can't hurt to be tidy about things on other platforms
> either though.
> 
> See: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=99356#c5
> 
> Signed-off-by: Philip Withnall <philip at tecnocode.co.uk>
> Signed-off-by: Karsten Otto <ottoka at posteo.de>

Please use non-mangled email addresses in the future. I don't think git
tools will gracefully de-mangle these for automatic Cc list gathering,
do they?

> ---
> Updated as per Bill Spitzak’s recommendation to make the change more concise.
> ---
>  src/connection.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/connection.c b/src/connection.c
> index f292853..1e271c4 100644
> --- a/src/connection.c
> +++ b/src/connection.c
> @@ -287,7 +287,7 @@ wl_connection_flush(struct wl_connection *connection)
>  		msg.msg_namelen = 0;
>  		msg.msg_iov = iov;
>  		msg.msg_iovlen = count;
> -		msg.msg_control = cmsg;
> +		msg.msg_control = (clen > 0) ? cmsg : NULL;
>  		msg.msg_controllen = clen;
>  		msg.msg_flags = 0;
>  

Pushed.


Thanks,
pq