[vlc-devel] [PATCH 3/3] configure: check for msg_flags in struct msghdr

Sean McGovern gseanmcg at gmail.com
Tue Apr 19 01:10:30 CEST 2016


Use it as appropriate in the UDP access module.
---
 configure.ac         |    5 +++++
 modules/access/udp.c |    4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 18d9b28..fc2176d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -702,6 +702,11 @@ AS_IF([test "${ac_cv_struct_sockaddr_storage}" = no], [
   AC_DEFINE(ss_family, sa_family)
 ])
 
+dnl Check for msg_flags in struct msghdr
+AC_CHECK_MEMBER([struct msghdr.msg_flags],
+[AC_DEFINE([HAVE_MSG_FLAGS],1,[Define if struct msghdr contains msg_flags])], [],
+[#include <sys/socket.h>])
+
 dnl FreeBSD has a gnugetopt library for this:
 GNUGETOPT_LIBS=""
 AC_CHECK_FUNC(getopt_long,, [
diff --git a/modules/access/udp.c b/modules/access/udp.c
index f1f4047..4c9a32b 100644
--- a/modules/access/udp.c
+++ b/modules/access/udp.c
@@ -302,7 +302,7 @@ static void* ThreadRead( void *data )
         struct msghdr msg = {
             .msg_iov = &iov,
             .msg_iovlen = 1,
-#ifdef __linux__
+#if HAVE_MSG_FLAGS && defined(MSG_TRUNC)
             .msg_flags = MSG_TRUNC,
 #endif
         };
@@ -332,7 +332,7 @@ static void* ThreadRead( void *data )
         while (len == -1);
         vlc_cleanup_pop();
 
-#ifdef MSG_TRUNC
+#if HAVE_MSG_FLAGS && defined(MSG_TRUNC)
         if (msg.msg_flags & MSG_TRUNC)
         {
             msg_Err(access, "%zd bytes packet truncated (MTU was %zu)",
-- 
1.7.9.2



More information about the vlc-devel mailing list