summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Dickson <steved@redhat.com>2015-04-27 09:58:23 -0400
committerSteve Dickson <steved@redhat.com>2015-04-27 10:05:32 -0400
commit97a4f20bc75424418b3e8125a7b72f482d9fae2e (patch)
tree7740a41510373ec412257422b1d7e60cbb3564b2
parentc4a97e78a0d3f8ae88749d9b40220203a8527b3a (diff)
downloadrpcbind-97a4f20bc75424418b3e8125a7b72f482d9fae2e.tar.gz
rpcbind: enable debugging in libtirpcrpcbind-0_2_3-rc3
Recently a libtirpc_set_debug() command was added to libtirpc that enables debugging in the library. Now when debug is enabled with rpcbind, this new library debugging will be enabled as well, when the interface exists. Signed-off-by: Steve Dickson <steved@redhat.com>
-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;