]> git.neil.brown.name Git - portmap.git/commitdiff
NO_PERROR: control overriding of perror() symbol
authorMike Frysinger <vapier@gentoo.org>
Tue, 11 Jan 2011 19:09:05 +0000 (14:09 -0500)
committerNeil Brown <neilb@suse.de>
Wed, 12 Jan 2011 06:21:14 +0000 (17:21 +1100)
Doing static builds of portmap might fail when the C library's perror()
function is pulled in and collides with portmap's definition.  So add a
flag to control the local override.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Neil Brown <neilb@suse.de>
Makefile
README
portmap.c

index 1864b1799c73d090ffb01667e0761c77f3f27fe4..fe9c7cb38384376056f565009a3c2827dc6e1fd1 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -32,6 +32,11 @@ ifneq ($(NO_FORK),)
 CPPFLAGS += -DNO_FORK
 endif
 
+# For static builds, we might hit perror() symbol clashes
+ifneq ($(NO_PERROR),)
+CPPFLAGS += -DNO_PERROR
+endif
+
 ifeq ($(PREFIX),)
 PREFIX = /usr
 endif
diff --git a/README b/README
index bda17070188dae7596605f41e4b0bd7f216ba089..05861a8103924acc56d3cfdfa6649980e67a0004 100644 (file)
--- a/README
+++ b/README
@@ -19,6 +19,7 @@ There is no "./configure", just use "make".
 Some make variable can be used to control compilation.
 
  NO_FORK=        if non-empty, don't use fork (good for nommu systems)
+ NO_PERROR=      if non-empty, don't override the perror() func
  NO_PIE=         if non-empty, don't build portmap as a PIE
  NO_TCP_WRAPPER=  if non-empty, don't use tcp_wrappers
  USE_DNS=        if set, tcp_wrappers can check peers based on hostname
index 89416ebe765e92342e042300e7a5ca1d98b36c05..5a935dcaa27f79e93f84663c143ed0ff1f08edb5 100644 (file)
--- a/portmap.c
+++ b/portmap.c
@@ -422,12 +422,14 @@ main(int argc, char **argv)
        abort();
 }
 
+#ifndef NO_PERROR
 /* need to override perror calls in rpc library */
 void perror(const char *what)
 {
 
        syslog(LOG_ERR, "%s: %m", what);
 }
+#endif
 
 static struct pmaplist *
 find_service(u_long prog, u_long vers, u_long prot)