summaryrefslogtreecommitdiffstats
path: root/usr.sbin/rpc.lockd
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>2001-11-13 11:24:23 +0000
committeralfred <alfred@FreeBSD.org>2001-11-13 11:24:23 +0000
commit286faba5487469ccabb21c244ccd470ad5d111c9 (patch)
treebad9997dbd8a4ffafa0a78beb8020cb932ee73ef /usr.sbin/rpc.lockd
parentae8c4c565e16ab2948916667f1a33417b33f49d9 (diff)
downloadFreeBSD-src-286faba5487469ccabb21c244ccd470ad5d111c9.zip
FreeBSD-src-286faba5487469ccabb21c244ccd470ad5d111c9.tar.gz
Turn on NO_WERROR and set WARNS to 1.
Fix the WARNS 1 warnings except unused variables. Add prototype for log_netobj(). Don't compare signed/unsigned. Cast u_int64_t to 'unsigned long long' and print using %llu. Fix constness of string arrays. Use a cast to avoid an unused parameter in a signal handler. alarm(2) can't fail, so don't check for it. ANSI'ify some functions.
Diffstat (limited to 'usr.sbin/rpc.lockd')
-rw-r--r--usr.sbin/rpc.lockd/Makefile2
-rw-r--r--usr.sbin/rpc.lockd/lock_proc.c15
-rw-r--r--usr.sbin/rpc.lockd/lockd.c16
-rw-r--r--usr.sbin/rpc.lockd/lockd_lock.c2
-rw-r--r--usr.sbin/rpc.lockd/lockd_lock.h12
5 files changed, 27 insertions, 20 deletions
diff --git a/usr.sbin/rpc.lockd/Makefile b/usr.sbin/rpc.lockd/Makefile
index 00864cf..de786a1 100644
--- a/usr.sbin/rpc.lockd/Makefile
+++ b/usr.sbin/rpc.lockd/Makefile
@@ -5,6 +5,8 @@ PROG= rpc.lockd
MAN= rpc.lockd.8
MLINKS= rpc.lockd.8 lockd.8
SRCS= kern.c nlm_prot_svc.c lockd.c lock_proc.c lockd_lock.c
+NO_WERROR= YES
+WARNS?= 1
CFLAGS+= -I. -I${DESTDIR}/usr/include/rpcsvc
diff --git a/usr.sbin/rpc.lockd/lock_proc.c b/usr.sbin/rpc.lockd/lock_proc.c
index e7115b6..06efd91 100644
--- a/usr.sbin/rpc.lockd/lock_proc.c
+++ b/usr.sbin/rpc.lockd/lock_proc.c
@@ -62,6 +62,7 @@ __RCSID("$NetBSD: lock_proc.c,v 1.7 2000/10/11 20:23:56 is Exp $");
#define CLIENT_CACHE_LIFETIME 120 /* In seconds */
static void log_from_addr __P((char *, struct svc_req *));
+static void log_netobj __P((netobj *obj));
static int addrcmp __P((struct sockaddr *, struct sockaddr *));
/* log_from_addr ----------------------------------------------------------- */
@@ -100,7 +101,7 @@ log_netobj(obj)
{
char objvalbuffer[(sizeof(char)*2)*MAX_NETOBJ_SZ+2];
char objascbuffer[sizeof(char)*MAX_NETOBJ_SZ+1];
- int i, maxlen;
+ unsigned int i, maxlen;
char *tmp1, *tmp2;
/* Notify of potential security attacks */
@@ -911,8 +912,10 @@ nlm4_test_4_svc(arg, rqstp)
syslog(LOG_DEBUG, "Owner Handle:\n");
log_netobj(&(arg->alock.oh));
syslog(LOG_DEBUG, "SVID: %d\n", arg->alock.svid);
- syslog(LOG_DEBUG, "Lock Offset: %d\n", arg->alock.l_offset);
- syslog(LOG_DEBUG, "Lock Length: %d\n", arg->alock.l_len);
+ syslog(LOG_DEBUG, "Lock Offset: %llu\n",
+ (unsigned long long)arg->alock.l_offset);
+ syslog(LOG_DEBUG, "Lock Length: %llu\n",
+ (unsigned long long)arg->alock.l_len);
syslog(LOG_DEBUG, "Exclusive: %s\n",
(arg->exclusive ? "true" : "false"));
}
@@ -1007,8 +1010,10 @@ nlm4_lock_4_svc(arg, rqstp)
syslog(LOG_DEBUG, "Owner Handle:\n");
log_netobj(&(arg->alock.oh));
syslog(LOG_DEBUG, "SVID: %d\n", arg->alock.svid);
- syslog(LOG_DEBUG, "Lock Offset: %d\n", arg->alock.l_offset);
- syslog(LOG_DEBUG, "Lock Length: %d\n", arg->alock.l_len);
+ syslog(LOG_DEBUG, "Lock Offset: %llu\n",
+ (unsigned long long)arg->alock.l_offset);
+ syslog(LOG_DEBUG, "Lock Length: %llu\n",
+ (unsigned long long)arg->alock.l_len);
syslog(LOG_DEBUG, "Block: %s\n", (arg->block ? "true" : "false"));
syslog(LOG_DEBUG, "Exclusive: %s\n", (arg->exclusive ? "true" : "false"));
syslog(LOG_DEBUG, "Reclaim: %s\n", (arg->reclaim ? "true" : "false"));
diff --git a/usr.sbin/rpc.lockd/lockd.c b/usr.sbin/rpc.lockd/lockd.c
index cd08f55..0397514 100644
--- a/usr.sbin/rpc.lockd/lockd.c
+++ b/usr.sbin/rpc.lockd/lockd.c
@@ -82,9 +82,9 @@ void nlm_prog_3 __P((struct svc_req *, SVCXPRT *));
void nlm_prog_4 __P((struct svc_req *, SVCXPRT *));
void usage __P((void));
-void sigalarm_handler __P((int));
+void sigalarm_handler __P((void));
-char *transports[] = { "udp", "tcp", "udp6", "tcp6" };
+const char *transports[] = { "udp", "tcp", "udp6", "tcp6" };
int
main(argc, argv)
@@ -196,7 +196,7 @@ main(argc, argv)
strerror(errno));
exit(1);
}
- sigalarm.sa_handler = sigalarm_handler;
+ sigalarm.sa_handler = (sig_t) sigalarm_handler;
sigemptyset(&sigalarm.sa_mask);
sigalarm.sa_flags = SA_RESETHAND; /* should only happen once */
sigalarm.sa_flags |= SA_RESTART;
@@ -206,11 +206,7 @@ main(argc, argv)
exit(1);
}
grace_expired = 0;
- if (alarm(10) < 0) {
- syslog(LOG_WARNING, "alarm failed: %s",
- strerror(errno));
- exit(1);
- }
+ alarm(10);
init_nsm();
@@ -221,9 +217,9 @@ main(argc, argv)
}
void
-sigalarm_handler(s)
- int s;
+sigalarm_handler(void)
{
+
grace_expired = 1;
}
diff --git a/usr.sbin/rpc.lockd/lockd_lock.c b/usr.sbin/rpc.lockd/lockd_lock.c
index 19c38a7..70b5115 100644
--- a/usr.sbin/rpc.lockd/lockd_lock.c
+++ b/usr.sbin/rpc.lockd/lockd_lock.c
@@ -778,7 +778,7 @@ do_mon(hostname)
void
notify(hostname, state)
- char *hostname;
+ const char *hostname;
int state;
{
struct file_lock *fl, *next_fl;
diff --git a/usr.sbin/rpc.lockd/lockd_lock.h b/usr.sbin/rpc.lockd/lockd_lock.h
index bcd9b6f..01a2efd 100644
--- a/usr.sbin/rpc.lockd/lockd_lock.h
+++ b/usr.sbin/rpc.lockd/lockd_lock.h
@@ -3,11 +3,15 @@
/* Headers and function declarations for file-locking utilities */
-struct nlm4_holder * testlock __P((struct nlm4_lock *, int, int));
+struct nlm4_holder * testlock(struct nlm4_lock *lock, bool_t exclusive,
+ int flags);
+enum nlm_stats getlock(nlm4_lockargs *lckarg, struct svc_req *rqstp,
+ const int flags);
+enum nlm_stats unlock(nlm4_lock *lock, const int flags);
+int lock_answer(int pid, netobj *netcookie, int result, int *pid_p,
+ int version);
-enum nlm_stats getlock __P((nlm4_lockargs *, struct svc_req *, int));
-enum nlm_stats unlock __P((nlm4_lock *, int));
-void notify __P((char *, int));
+void notify(const char *hostname, const int state);
/* flags for testlock, getlock & unlock */
#define LOCK_ASYNC 0x01 /* async version (getlock only) */
OpenPOWER on IntegriCloud