aboutsummaryrefslogtreecommitdiff
blob: b2760d2b77b4bc25d145fc30b7b8990acb147cef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
From https://patchwork.kernel.org/patch/5499671/:

    Subject: [6/9] Define struct rpcent on non GNU libc
    From: Natanael Copa <ncopa@alpinelinux.org>
    X-Patchwork-Id: 5499671
    Message-Id: <1418718540-13667-7-git-send-email-ncopa@alpinelinux.org>
    To: libtirpc-devel@lists.sourceforge.net
    Cc: linux-nfs@vger.kernel.org, Natanael Copa <ncopa@alpinelinux.org>
    Date: Tue, 16 Dec 2014 09:28:57 +0100

    This fixes the following compile error with musl libc:
    getrpcent.c:65:16: error: field 'rpc' has incomplete type
      struct rpcent rpc;
                    ^

    Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
    ---
    This patch could probably be better. It assumes that only GNU libc has
    the rpcent struct defined, but the BSDs probably has it too.

    I am not sure if uClibc has it, but uClibc does define __GLIBC__ so it
    might be broken there too.

    I looked into using AC_CHECK_MEMBER but I don't think it is a good idea
    so depend on config.h since this is a header that will be installed on
    the system.

    I also found out that struct rpcent is also defined in
    /usr/include/gssrpc/netdb.h but I am unsure if we can depend on that
    too since GSS is optional.

    So I am a bit in doubt what the proper fix is. Meanwhile, this works
    for musl libc.

We fix the uClibc case by checking for __UCLIBC__ as well, since uClibc will
define __GLIBC__ as well (why?) as __UCLIBC__.  This should not affect the
musl case.
---

diff -Naurp libtirpc-1.0.1.orig/tirpc/rpc/rpcent.h libtirpc-1.0.1/tirpc/rpc/rpcent.h
--- libtirpc-1.0.1.orig/tirpc/rpc/rpcent.h	2015-10-30 15:15:14.000000000 +0000
+++ libtirpc-1.0.1/tirpc/rpc/rpcent.h	2017-07-05 04:58:27.141468000 +0000
@@ -49,7 +49,7 @@ extern "C" {
 #endif
 
 /* These are defined in /usr/include/rpc/netdb.h */
-#if !defined(__GLIBC__)
+#if !defined(__GLIBC__) || defined(__UCLIBC__)
 struct rpcent {
 	char	*r_name;	/* name of server for this rpc program */
 	char	**r_aliases;	/* alias list */