The cirros image was rebuilt against the 3.13.0-83 kernel, drivers e1000e, igbvf...
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / nfs-utils / 0005-Allow-usage-of-getrpcbynumber-when-getrpcbynumber_r-.patch
1 From a4c15a4f9f49fd2ae5eee7eef54c67f4842952b2 Mon Sep 17 00:00:00 2001
2 From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3 Date: Sat, 10 Nov 2012 18:42:28 +0100
4 Subject: [PATCH] Allow usage of getrpcbynumber() when getrpcbynumber_r() is
5  not available
6
7 getrpcbynumber_r() is not implemented by libtirpc at the moment, only
8 the non-reentrant getrpcbynumber() is available. Since nfs-utils seems
9 to only be using getrpcbynumber_r() is a non multithreaded context,
10 using getrpcbynumber() should work just as well.
11
12 We also take this opportunity to adjust the autoconf checks to verify
13 whether any of getrpcbynumber() or getrpcbynumber_r() is available,
14 and error out if none of them is available.
15
16 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
17 ---
18  configure.ac             |    8 ++++----
19  support/nfs/svc_socket.c |    6 ++++++
20  2 files changed, 10 insertions(+), 4 deletions(-)
21
22 diff --git a/configure.ac b/configure.ac
23 index b408f1b..41216c9 100644
24 --- a/configure.ac
25 +++ b/configure.ac
26 @@ -246,9 +246,6 @@ AC_CHECK_FUNC([connect], ,
27  AC_CHECK_FUNC([getaddrinfo], ,
28                [AC_MSG_ERROR([Function 'getaddrinfo' not found.])])
29  
30 -AC_CHECK_FUNC([getrpcbynumber], ,
31 -              [AC_MSG_ERROR([Function 'getrpcbynumber' not found.])])
32 -
33  AC_CHECK_FUNC([getservbyname], ,
34                [AC_MSG_ERROR([Function 'getservbyname' not found.])])
35  
36 @@ -393,8 +390,11 @@ AC_CHECK_FUNCS([alarm atexit dup2 fdatasync ftruncate getcwd \
37                 getnameinfo getrpcbyname getifaddrs \
38                 gettimeofday hasmntopt inet_ntoa innetgr memset mkdir pathconf \
39                 realpath rmdir select socket strcasecmp strchr strdup \
40 -               strerror strrchr strtol strtoul sigprocmask])
41 +               strerror strrchr strtol strtoul sigprocmask getrpcbynumber getrpcbynumber_r])
42  
43 +if test "$ac_cv_func_getrpcbynumber_r" != "yes" -a "$ac_cv_func_getrpcbynumber" != "yes"; then
44 +   AC_MSG_ERROR([Neither getrpcbynumber_r nor getrpcbynumber are available])
45 +fi
46  
47  dnl *************************************************************
48  dnl Check for data sizes
49 diff --git a/support/nfs/svc_socket.c b/support/nfs/svc_socket.c
50 index f56f310..61ccf5b 100644
51 --- a/support/nfs/svc_socket.c
52 +++ b/support/nfs/svc_socket.c
53 @@ -42,8 +42,14 @@ int getservport(u_long number, const char *proto)
54         struct servent servbuf, *servp = NULL;
55         int ret;
56  
57 +#if HAVE_GETRPCBYNUMBER_R
58         ret = getrpcbynumber_r(number, &rpcbuf, rpcdata, sizeof rpcdata,
59                                 &rpcp);
60 +#else
61 +       rpcp = getrpcbynumber(number);
62 +       ret = 0;
63 +#endif
64 +
65         if (ret == 0 && rpcp != NULL) {
66                 /* First try name.  */
67                 ret = getservbyname_r(rpcp->r_name, proto, &servbuf, servdata,
68 -- 
69 1.7.9.5
70