[SCM] libdvbpsi/master: Fix FTBFS on kreebsd-*
sramacher at users.alioth.debian.org
sramacher at users.alioth.debian.org
Wed Jul 24 13:06:05 UTC 2013
The following commit has been merged in the master branch:
commit 4b32dd771f3830f13fc230c2abd91ebfde2688d9
Author: Sebastian Ramacher <sramacher at debian.org>
Date: Wed Jul 24 15:01:48 2013 +0200
Fix FTBFS on kreebsd-*
diff --git a/debian/patches/fix-kfreebsd-build.patch b/debian/patches/fix-kfreebsd-build.patch
new file mode 100644
index 0000000..18843b7
--- /dev/null
+++ b/debian/patches/fix-kfreebsd-build.patch
@@ -0,0 +1,121 @@
+Description: Fix build failure on kfreebsd
+ MSG_CMSG_CLOEXEC is a flag for recvmsg and not recv. Thus rewrite
+ {udp,tcp}_open to create sockets with SOCK_CLOEXEC. If SOCK_CLOEXEC is not
+ available, FD_CLOEXEC is set instead.
+Author: Sebastian Ramacher <sramacher at debian.org>
+Last-Update: 2013-07-24
+
+--- libdvbpsi-1.0.0.orig/examples/dvbinfo/udp.c
++++ libdvbpsi-1.0.0/examples/dvbinfo/udp.c
+@@ -49,6 +49,11 @@
+ # include <arpa/inet.h>
+ #endif
+
++#ifndef SOCK_CLOEXEC
++#include <unistd.h>
++#include <fcntl.h>
++#endif
++
+ #include <assert.h>
+
+ #include "udp.h"
+@@ -213,13 +218,33 @@ int udp_open(const char *interface, cons
+
+ for (struct addrinfo *ptr = addr; ptr != NULL; ptr = ptr->ai_next )
+ {
++#ifdef SOCK_CLOEXEC
++ s_ctl = socket(ptr->ai_family, ptr->ai_socktype | SOCK_CLOEXEC, ptr->ai_protocol);
++#else
+ s_ctl = socket(ptr->ai_family, ptr->ai_socktype, ptr->ai_protocol);
++#endif
+ if (s_ctl <= 0)
+ {
+ perror("udp socket error");
+ continue;
+ }
+
++#ifndef SOCK_CLOEXEC
++ int flags = fcntl(s_ctl, F_GETFD);
++ if (flags == -1)
++ {
++ close(s_ctl);
++ perror("udp socket error");
++ continue;
++ }
++ if (fcntl(s_ctl, F_SETFD, flags | FD_CLOEXEC) == -1)
++ {
++ close(s_ctl);
++ perror("udp socket error");
++ continue;
++ }
++#endif
++
+ /* Increase the receive buffer size to 1/2MB (8Mb/s during 1/2s)
+ * to avoid packet loss caused in case of scheduling hiccups */
+ setsockopt (s_ctl, SOL_SOCKET, SO_RCVBUF,
+@@ -259,7 +284,7 @@ ssize_t udp_read(int fd, void *buf, size
+ {
+ ssize_t err;
+ again:
+- err = recv(fd, buf, count, MSG_CMSG_CLOEXEC);
++ err = recv(fd, buf, count, 0);
+ if (err < 0)
+ {
+ switch(errno)
+--- libdvbpsi-1.0.0.orig/examples/dvbinfo/tcp.c
++++ libdvbpsi-1.0.0/examples/dvbinfo/tcp.c
+@@ -52,6 +52,11 @@
+ # include <arpa/inet.h>
+ #endif
+
++#ifndef SOCK_CLOEXEC
++#include <unistd.h>
++#include <fcntl.h>
++#endif
++
+ #include "tcp.h"
+
+ #ifdef HAVE_SYS_SOCKET_H
+@@ -100,13 +105,33 @@ int tcp_open(const char *ipaddress, int
+
+ for (struct addrinfo *ptr = addr; ptr != NULL; ptr = ptr->ai_next )
+ {
++#ifdef SOCK_CLOEXEC
++ s_ctl = socket(ptr->ai_family, ptr->ai_socktype | SOCK_CLOEXEC, ptr->ai_protocol);
++#else
+ s_ctl = socket(ptr->ai_family, ptr->ai_socktype, ptr->ai_protocol);
++#endif
+ if (s_ctl <= 0)
+ {
+ perror("tcp socket error");
+ continue;
+ }
+
++#ifndef SOCK_CLOEXEC
++ int flags = fcntl(s_ctl, F_GETFD);
++ if (flags == -1)
++ {
++ close(s_ctl);
++ perror("tcp socket error");
++ continue;
++ }
++ if (fcntl(s_ctl, F_SETFD, flags | FD_CLOEXEC) == -1)
++ {
++ close(s_ctl);
++ perror("tcp socket error");
++ continue;
++ }
++#endif
++
+ setsockopt (s_ctl, SOL_SOCKET, SO_REUSEADDR, &(int){ 1 }, sizeof (int));
+
+ result = connect( s_ctl, ptr->ai_addr, ptr->ai_addrlen );
+@@ -128,7 +153,7 @@ ssize_t tcp_read(int fd, void *buf, size
+ {
+ ssize_t err;
+ again:
+- err = recv(fd, buf, count, MSG_CMSG_CLOEXEC | MSG_WAITALL);
++ err = recv(fd, buf, count, MSG_WAITALL);
+ if (err < 0)
+ {
+ switch(errno)
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..5ad6215
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+fix-kfreebsd-build.patch
--
libdvbpsi packaging
More information about the pkg-multimedia-commits
mailing list