summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am4
-rw-r--r--configure.ac4
-rw-r--r--src/rpcbind.c12
3 files changed, 17 insertions, 3 deletions
diff --git a/Makefile.am b/Makefile.am
index 3add1e3..5ec8cd6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -17,6 +17,10 @@ AM_CPPFLAGS += -DRPCBIND_DEBUG -DDEBUG_RMTCALL
AM_CPPFLAGS += -DND_DEBUG -DBIND_DEBUG
endif
+if LIBSETDEBUG
+AM_CPPFLAGS += -DLIB_SET_DEBUG
+endif
+
if WARMSTART
AM_CPPFLAGS += -DWARMSTART
endif
diff --git a/configure.ac b/configure.ac
index 39cd129..90e1db5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12,6 +12,10 @@ AM_CONDITIONAL(LIBWRAP, test x$enable_libwrap = xyes)
AC_ARG_ENABLE([debug],
AS_HELP_STRING([--enable-debug], [Turns on rpcbind debugging @<:@default=no@:>@]))
AM_CONDITIONAL(DEBUG, test x$enable_debug = xyes)
+if test x"$enable_debug" = xyes; then
+ AC_CHECK_LIB([tirpc], [libtirpc_set_debug], [lib_setdebug=yes])
+fi
+AM_CONDITIONAL(LIBSETDEBUG, test x$lib_setdebug = xyes)
AC_ARG_ENABLE([warmstarts],
AS_HELP_STRING([--enable-warmstarts], [Enables Warm Starts @<:@default=no@:>@]))
diff --git a/src/rpcbind.c b/src/rpcbind.c
index 6d8bed2..045daa1 100644
--- a/src/rpcbind.c
+++ b/src/rpcbind.c
@@ -117,6 +117,9 @@ int nhosts = 0;
int on = 1;
int rpcbindlockfd;
+#ifdef LIB_SET_DEBUG
+void libtirpc_set_debug(char *name, int level, int use_stderr);
+#endif
#ifdef WARMSTART
/* Local Variable */
static int warmstart = 0; /* Grab an old copy of registrations. */
@@ -199,9 +202,12 @@ main(int argc, char *argv[])
xlog_syslog(FALSE);
xlog_stderr(TRUE);
}
- if (debugging)
+ if (debugging) {
xlog_config(D_ALL, 1);
-
+#ifdef LIB_SET_DEBUG
+ libtirpc_set_debug("rpcbind", debugging, (dofork == 0));
+#endif
+ }
rpc_control(RPC_SVC_CONNMAXREC_SET, &maxrec);
init_transport(nconf);
@@ -870,7 +876,7 @@ parseargs(int argc, char *argv[])
break; /* errors; for rpcbind developers */
/* only! */
case 'd':
- debugging = 1;
+ debugging++;
break;
case 'h':
++nhosts;