[vlc-commits] configure: check for msg_flags in struct msghdr

Sean McGovern git at videolan.org
Tue Apr 19 11:00:57 CEST 2016


vlc | branch: master | Sean McGovern <gseanmcg at gmail.com> | Mon Apr 18 19:10:30 2016 -0400| [770fad69bacbc3abb1c39833a520b6274cb585e7] | committer: Jean-Baptiste Kempf

configure: check for msg_flags in struct msghdr

Use it as appropriate in the UDP access module.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=770fad69bacbc3abb1c39833a520b6274cb585e7
---

 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)",



More information about the vlc-commits mailing list