diff options
-rw-r--r-- | sbin/mountd/mountd.8 | 9 | ||||
-rw-r--r-- | sbin/mountd/mountd.c | 30 |
2 files changed, 22 insertions, 17 deletions
diff --git a/sbin/mountd/mountd.8 b/sbin/mountd/mountd.8 index 423e8df2e59..1ed6cb47af8 100644 --- a/sbin/mountd/mountd.8 +++ b/sbin/mountd/mountd.8 @@ -1,4 +1,4 @@ -.\" $NetBSD: mountd.8,v 1.9 1995/03/18 14:58:30 cgd Exp $ +.\" $NetBSD: mountd.8,v 1.10 1995/11/06 07:00:14 thorpej Exp $ .\" .\" Copyright (c) 1989, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -43,7 +43,7 @@ mount requests .Sh SYNOPSIS .Nm /sbin/mountd -.Op Fl n +.Op Fl dn .Op Ar exportsfile .Sh DESCRIPTION .Xr Mountd @@ -60,6 +60,11 @@ RFC1094. Options and operands available for .Nm mountd : .Bl -tag -width Ds +.It Fl d +Enable debugging mode. +.Xr Mountd +will not detach from the controlling terminal and will print +debugging messages to stderr. .It Fl n Do not require that clients make mount requests from reserved ports. (Normally, only mount requsts from reserved ports are accepted.) diff --git a/sbin/mountd/mountd.c b/sbin/mountd/mountd.c index 133e6a490ef..f058461300b 100644 --- a/sbin/mountd/mountd.c +++ b/sbin/mountd/mountd.c @@ -1,4 +1,4 @@ -/* $NetBSD: mountd.c,v 1.27.2.1 1995/11/01 00:06:22 jtc Exp $ */ +/* $NetBSD: mountd.c,v 1.30 1995/11/28 05:25:47 jtc Exp $ */ /* * Copyright (c) 1989, 1993 @@ -46,7 +46,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)mountd.c 8.8 (Berkeley) 2/20/94"; #else -static char rcsid[] = "$NetBSD: mountd.c,v 1.27.2.1 1995/11/01 00:06:22 jtc Exp $"; +static char rcsid[] = "$NetBSD: mountd.c,v 1.30 1995/11/28 05:25:47 jtc Exp $"; #endif #endif /* not lint */ @@ -82,9 +82,7 @@ static char rcsid[] = "$NetBSD: mountd.c,v 1.27.2.1 1995/11/01 00:06:22 jtc Exp #include <unistd.h> #include "pathnames.h" -#ifdef DEBUG #include <stdarg.h> -#endif /* * Structures for keeping the mount list and export list @@ -220,19 +218,15 @@ int opt_flags; #define OP_ISO 0x20 #define OP_ALLDIRS 0x40 -#ifdef DEBUG -int debug = 1; -void SYSLOG __P((int, const char *, ...)); -#define syslog SYSLOG -#else int debug = 0; -#endif +void SYSLOG __P((int, const char *, ...)); /* * Mountd server for NFS mount protocol as described in: * NFS: Network File System Protocol Specification, RFC1094, Appendix A * The optional arguments are the exports file name * default: _PATH_EXPORTS + * "-d" to enable debugging * and "-n" to allow nonroot mount. */ int @@ -243,13 +237,16 @@ main(argc, argv) SVCXPRT *udptransp, *tcptransp; int c; - while ((c = getopt(argc, argv, "n")) != EOF) + while ((c = getopt(argc, argv, "dn")) != EOF) switch (c) { + case 'd': + debug = 1; + break; case 'n': resvport_only = 0; break; default: - fprintf(stderr, "Usage: mountd [-n] [export_file]\n"); + fprintf(stderr, "Usage: mountd [-dn] [export_file]\n"); exit(1); }; argc -= optind; @@ -1928,17 +1925,20 @@ free_grp(grp) free((caddr_t)grp); } -#ifdef DEBUG void SYSLOG(int pri, const char *fmt, ...) { va_list ap; va_start(ap, fmt); - vfprintf(stderr, fmt, ap); + + if (debug) + vfprintf(stderr, fmt, ap); + else + vsyslog(pri, fmt, ap); + va_end(ap); } -#endif /* DEBUG */ /* * Check options for consistency. |