From 5f8568ec815ca0c14ac775b5cf25ecc1958c7247 Mon Sep 17 00:00:00 2001 From: Alfred Perlstein Date: Wed, 25 Apr 2001 18:40:38 +0000 Subject: [PATCH] Fix compiling without -O, some dead code was using non-existant functions, make the code not automatically dead but actually use the debug level in order to determine if output is needed. Fix non-existant from_addr() by #define'ing it to inet_ntoa(). Remove hardcoded -g from Makefile. Reported by: "John W. De Boskey" Tested by: "John W. De Boskey" --- usr.sbin/rpc.lockd/Makefile | 2 +- usr.sbin/rpc.lockd/kern.c | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/usr.sbin/rpc.lockd/Makefile b/usr.sbin/rpc.lockd/Makefile index 2e8aa474d170..fad4a769f73d 100644 --- a/usr.sbin/rpc.lockd/Makefile +++ b/usr.sbin/rpc.lockd/Makefile @@ -6,7 +6,7 @@ SRCS= kern.c nlm_prot_svc.c lockd.c lock_proc.c lockd_lock.c MAN= rpc.lockd.8 MLINKS= rpc.lockd.8 lockd.8 -CFLAGS+= -I. -I${DESTDIR}/usr/include/rpcsvc -g +CFLAGS+= -I. -I${DESTDIR}/usr/include/rpcsvc DPADD= ${LIBRPCSVC} ${LIBUTIL} LDADD= -lrpcsvc -lutil diff --git a/usr.sbin/rpc.lockd/kern.c b/usr.sbin/rpc.lockd/kern.c index 730646c4bbba..b7788fd6ae09 100644 --- a/usr.sbin/rpc.lockd/kern.c +++ b/usr.sbin/rpc.lockd/kern.c @@ -80,8 +80,11 @@ int unlock_request(LOCKD_MSG *); #define lockd_seteuid(uid) (1) #endif -#define d_calls 0 -#define d_args 0 +#define d_calls (debug_level > 1) +#define d_args (debug_level > 2) + +#define from_addr(sockaddr) \ + (inet_ntoa((sockaddr)->sin_addr)) void client_cleanup(sig, code) @@ -451,9 +454,10 @@ lock_answer(int pid, netobj *netcookie, int result, int *pid_p, int version) } if (d_calls) - syslog(LOG_DEBUG, "lock answer: pid %lu: %s", - ans.la_msg_ident.pid, version == NLM_VERS4 ? - show_4state(result) : show_state(result)); + syslog(LOG_DEBUG, "lock answer: pid %lu: %s %d", + ans.la_msg_ident.pid, + version == NLM_VERS4 ? "nlmv4" : "nlmv3", + result); ans.la_set_getlk_pid = 0; if (version == NLM_VERS4)