From 6f063b7eca51f1f3c9fb19e2207e3797f3f1bd5d Mon Sep 17 00:00:00 2001 From: Michael Olbrich Date: Sun, 24 May 2020 11:09:02 +0200 Subject: host-unfs3: fix building with gcc 10 And order the patches a bit. Signed-off-by: Michael Olbrich --- .../unfs3-0.9.22/0003-use-libtirpc-if-found.patch | 62 ++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 patches/unfs3-0.9.22/0003-use-libtirpc-if-found.patch (limited to 'patches/unfs3-0.9.22/0003-use-libtirpc-if-found.patch') 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 +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 +--- + 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 ]) + AC_CHECK_HEADERS(stdint.h,,,[#include ]) + AC_CHECK_HEADERS(sys/mnttab.h,,,[#include ]) +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); -- cgit v1.2.3