[vlc-commits] gnutls: do not assume IOV_MAX is defined
Rémi Denis-Courmont
git at videolan.org
Mon Jan 18 18:08:13 CET 2016
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Jan 18 19:07:36 2016 +0200| [d88c17f1fff5a0d0b562f44bbc4144e16f267a1b] | committer: Rémi Denis-Courmont
gnutls: do not assume IOV_MAX is defined
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d88c17f1fff5a0d0b562f44bbc4144e16f267a1b
---
modules/misc/gnutls.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/modules/misc/gnutls.c b/modules/misc/gnutls.c
index 119c3cc..43ef396 100644
--- a/modules/misc/gnutls.c
+++ b/modules/misc/gnutls.c
@@ -28,6 +28,7 @@
#include <time.h>
#include <errno.h>
#include <assert.h>
+#include <unistd.h>
#include <vlc_common.h>
#include <vlc_plugin.h>
@@ -145,7 +146,12 @@ static ssize_t vlc_gnutls_read(gnutls_transport_ptr_t ptr, void *buf,
static ssize_t vlc_gnutls_writev(gnutls_transport_ptr_t ptr,
const giovec_t *giov, int iovcnt)
{
- if (unlikely((unsigned)iovcnt > IOV_MAX))
+#ifdef IOV_MAX
+ const long iovmax = IOV_MAX;
+#else
+ const long iovmax = sysconf(_SC_IOV_MAX);
+#endif
+ if (unlikely(iovcnt > iovmax))
{
errno = EINVAL;
return -1;
More information about the vlc-commits
mailing list