X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=cirros-testvm%2Fsrc-cirros%2Fbuildroot-2015.05%2Fpackage%2Fnfs-utils%2F0005-Allow-usage-of-getrpcbynumber-when-getrpcbynumber_r-.patch;fp=cirros-testvm%2Fsrc-cirros%2Fbuildroot-2015.05%2Fpackage%2Fnfs-utils%2F0005-Allow-usage-of-getrpcbynumber-when-getrpcbynumber_r-.patch;h=7c9f3c38f6375137001ba73dbd9c425ee3dd7837;hb=b0a0f15dfaa205161a7fcb20cf1b8cd4948c2ef3;hp=0000000000000000000000000000000000000000;hpb=c6ac3cd55ee2da956195eee393b0882105dfad4e;p=packages%2Ftrusty%2Fcirros-testvm.git diff --git a/cirros-testvm/src-cirros/buildroot-2015.05/package/nfs-utils/0005-Allow-usage-of-getrpcbynumber-when-getrpcbynumber_r-.patch b/cirros-testvm/src-cirros/buildroot-2015.05/package/nfs-utils/0005-Allow-usage-of-getrpcbynumber-when-getrpcbynumber_r-.patch new file mode 100644 index 0000000..7c9f3c3 --- /dev/null +++ b/cirros-testvm/src-cirros/buildroot-2015.05/package/nfs-utils/0005-Allow-usage-of-getrpcbynumber-when-getrpcbynumber_r-.patch @@ -0,0 +1,70 @@ +From a4c15a4f9f49fd2ae5eee7eef54c67f4842952b2 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Sat, 10 Nov 2012 18:42:28 +0100 +Subject: [PATCH] Allow usage of getrpcbynumber() when getrpcbynumber_r() is + not available + +getrpcbynumber_r() is not implemented by libtirpc at the moment, only +the non-reentrant getrpcbynumber() is available. Since nfs-utils seems +to only be using getrpcbynumber_r() is a non multithreaded context, +using getrpcbynumber() should work just as well. + +We also take this opportunity to adjust the autoconf checks to verify +whether any of getrpcbynumber() or getrpcbynumber_r() is available, +and error out if none of them is available. + +Signed-off-by: Thomas Petazzoni +--- + configure.ac | 8 ++++---- + support/nfs/svc_socket.c | 6 ++++++ + 2 files changed, 10 insertions(+), 4 deletions(-) + +diff --git a/configure.ac b/configure.ac +index b408f1b..41216c9 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -246,9 +246,6 @@ AC_CHECK_FUNC([connect], , + AC_CHECK_FUNC([getaddrinfo], , + [AC_MSG_ERROR([Function 'getaddrinfo' not found.])]) + +-AC_CHECK_FUNC([getrpcbynumber], , +- [AC_MSG_ERROR([Function 'getrpcbynumber' not found.])]) +- + AC_CHECK_FUNC([getservbyname], , + [AC_MSG_ERROR([Function 'getservbyname' not found.])]) + +@@ -393,8 +390,11 @@ AC_CHECK_FUNCS([alarm atexit dup2 fdatasync ftruncate getcwd \ + getnameinfo getrpcbyname getifaddrs \ + gettimeofday hasmntopt inet_ntoa innetgr memset mkdir pathconf \ + realpath rmdir select socket strcasecmp strchr strdup \ +- strerror strrchr strtol strtoul sigprocmask]) ++ strerror strrchr strtol strtoul sigprocmask getrpcbynumber getrpcbynumber_r]) + ++if test "$ac_cv_func_getrpcbynumber_r" != "yes" -a "$ac_cv_func_getrpcbynumber" != "yes"; then ++ AC_MSG_ERROR([Neither getrpcbynumber_r nor getrpcbynumber are available]) ++fi + + dnl ************************************************************* + dnl Check for data sizes +diff --git a/support/nfs/svc_socket.c b/support/nfs/svc_socket.c +index f56f310..61ccf5b 100644 +--- a/support/nfs/svc_socket.c ++++ b/support/nfs/svc_socket.c +@@ -42,8 +42,14 @@ int getservport(u_long number, const char *proto) + struct servent servbuf, *servp = NULL; + int ret; + ++#if HAVE_GETRPCBYNUMBER_R + ret = getrpcbynumber_r(number, &rpcbuf, rpcdata, sizeof rpcdata, + &rpcp); ++#else ++ rpcp = getrpcbynumber(number); ++ ret = 0; ++#endif ++ + if (ret == 0 && rpcp != NULL) { + /* First try name. */ + ret = getservbyname_r(rpcp->r_name, proto, &servbuf, servdata, +-- +1.7.9.5 +