From 0f41eb8945d8116d69297dbd0aa748c02d580d36 Mon Sep 17 00:00:00 2001 From: neilbrown Date: Wed, 2 Jul 2003 06:51:21 +0000 Subject: [PATCH 1/1] See Changelog --- ChangeLog | 9 +++++++++ utils/mountd/mountd.c | 1 + utils/mountd/mountd.man | 2 +- utils/nfsstat/nfsstat.c | 28 +++++++++++++++++++++++----- 4 files changed, 34 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7c22de7..0f490c1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2003-07-02 NeilBrown + Steve Dickson + + * utils/mountd/mountd.man: Add valid kinds of debugging. + * utils/mountd/mountd.c(main): ignore SIGPIPE + * utils/nfsstat/nfsstat.c: fine-tune printing of warning so + we don't get warnings about unavailable stats that weren't asked + for. + 2003-06-24 NeilBrown * support/nfs/nfsexport.c(exp_unexp): When unexporting filesystems diff --git a/utils/mountd/mountd.c b/utils/mountd/mountd.c index 3769c92..953891d 100644 --- a/utils/mountd/mountd.c +++ b/utils/mountd/mountd.c @@ -520,6 +520,7 @@ main(int argc, char **argv) sigaction(SIGHUP, &sa, NULL); sigaction(SIGINT, &sa, NULL); sigaction(SIGTERM, &sa, NULL); + sigaction(SIGPIPE, &sa, NULL); /* WARNING: the following works on Linux and SysV, but not BSD! */ sigaction(SIGCHLD, &sa, NULL); diff --git a/utils/mountd/mountd.man b/utils/mountd/mountd.man index f68dd17..77f4e26 100644 --- a/utils/mountd/mountd.man +++ b/utils/mountd/mountd.man @@ -56,7 +56,7 @@ a stale entry will remain in .SH OPTIONS .TP .B \-d kind " or " \-\-debug kind -Turn on debugging for kind. +Turn on debugging. Valid kinds are: all, auth, call, general and parse. .TP .B \-F " or " \-\-foreground Run in foreground (do not daemonize) diff --git a/utils/nfsstat/nfsstat.c b/utils/nfsstat/nfsstat.c index b26b3b8..55c4096 100644 --- a/utils/nfsstat/nfsstat.c +++ b/utils/nfsstat/nfsstat.c @@ -124,6 +124,8 @@ main(int argc, char **argv) int opt_all = 0, opt_srv = 0, opt_clt = 0, + srv_info = 0, + clt_info = 0, opt_prt = 0; int c; @@ -184,9 +186,25 @@ main(int argc, char **argv) "server.\n"); } - if ((opt_srv && !parse_statfile(NFSSVCSTAT, svcinfo)) - || (opt_clt && !parse_statfile(NFSCLTSTAT, cltinfo))) - return 2; + if (opt_srv) { + srv_info = parse_statfile(NFSSVCSTAT, svcinfo); + if (srv_info == 0 && opt_clt == 0) { + fprintf(stderr, "Warning: No Server Stats (%s: %m).\n", NFSSVCSTAT); + return 2; + } + if (srv_info == 0) + opt_srv = 0; + } + + if (opt_clt) { + clt_info = parse_statfile(NFSCLTSTAT, cltinfo); + if (opt_srv == 0 && clt_info == 0) { + fprintf(stderr, "Warning: No Client Stats (%s: %m).\n", NFSCLTSTAT); + return 2; + } + if (clt_info == 0) + opt_clt = 0; + } if (opt_srv) { if (opt_prt & PRNT_NET) { @@ -340,8 +358,8 @@ parse_statfile(const char *name, struct statinfo *statp) * be a fatal error -- it usually means the module isn't loaded. */ if ((fp = fopen(name, "r")) == NULL) { - fprintf(stderr, "Warning: %s: %m\n", name); - return 1; + // fprintf(stderr, "Warning: %s: %m\n", name); + return 0; } while (fgets(buffer, sizeof(buffer), fp) != NULL) { -- 2.39.2