summaryrefslogtreecommitdiffstats
path: root/patches/unfs3-0.9.22/0003-use-libtirpc-if-found.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/unfs3-0.9.22/0003-use-libtirpc-if-found.patch')
-rw-r--r--patches/unfs3-0.9.22/0003-use-libtirpc-if-found.patch62
1 files changed, 62 insertions, 0 deletions
diff --git a/patches/unfs3-0.9.22/0003-use-libtirpc-if-found.patch b/patches/unfs3-0.9.22/0003-use-libtirpc-if-found.patch
new file mode 100644
index 000000000..17390362a
--- /dev/null
+++ b/patches/unfs3-0.9.22/0003-use-libtirpc-if-found.patch
@@ -0,0 +1,62 @@
+From: Michael Olbrich <m.olbrich@pengutronix.de>
+Date: Tue, 27 Aug 2019 21:42:24 +0200
+Subject: [PATCH] use libtirpc if found
+
+sunrpc was deprecated in glibc a long time ago. Some distributions, for
+example Arch Linux, have disabled sunrpc. As a result building fails.
+
+Use libtirpc if it is available. Use sunrpc otherwise.
+
+libtirpc will not listen if the socket is already bound, so do it before
+calling svctcp_create().
+
+Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
+---
+ configure.ac | 3 +++
+ daemon.c | 5 +++--
+ 2 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index cf1d9d107c82..668fbda2f0be 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -9,6 +9,9 @@ AC_SYS_LARGEFILE
+ AC_SEARCH_LIBS(xdr_int, nsl)
+ AC_SEARCH_LIBS(socket, socket)
+ AC_SEARCH_LIBS(inet_aton, resolv)
++PKG_CHECK_MODULES([TIRPC], [libtirpc],
++ [CFLAGS="$CFLAGS $TIRPC_CFLAGS"
++ LIBS="$LIBS $TIRPC_LIBS"],[:])
+ AC_CHECK_HEADERS(mntent.h,,,[#include <stdio.h>])
+ AC_CHECK_HEADERS(stdint.h,,,[#include <stdio.h>])
+ AC_CHECK_HEADERS(sys/mnttab.h,,,[#include <stdio.h>])
+diff --git a/daemon.c b/daemon.c
+index d14af4509b12..fbd901f5e19d 100644
+--- a/daemon.c
++++ b/daemon.c
+@@ -110,7 +110,7 @@ void logmsg(int prio, const char *fmt, ...)
+ */
+ struct in_addr get_remote(struct svc_req *rqstp)
+ {
+- return (svc_getcaller(rqstp->rq_xprt))->sin_addr;
++ return ((struct sockaddr_in *)svc_getcaller(rqstp->rq_xprt))->sin_addr;
+ }
+
+ /*
+@@ -118,7 +118,7 @@ struct in_addr get_remote(struct svc_req *rqstp)
+ */
+ short get_port(struct svc_req *rqstp)
+ {
+- return (svc_getcaller(rqstp->rq_xprt))->sin_port;
++ return ((struct sockaddr_in *)svc_getcaller(rqstp->rq_xprt))->sin_port;
+ }
+
+ /*
+@@ -779,6 +779,7 @@ static SVCXPRT *create_tcp_transport(unsigned int port)
+ fprintf(stderr, "Couldn't bind to tcp port %d\n", port);
+ exit(1);
+ }
++ listen(sock, SOMAXCONN);
+ }
+
+ transp = svctcp_create(sock, 0, 0);