From: Steve Dickson <SteveD@redhat.com>
To: nfs@lists.sourceforge.net
Subject: [PATCH] nfs-utils - 4 of 6 - nfsstat - removed needless warning
Date: Wed, 18 Jun 2003 14:00:57 -0400 [thread overview]
Message-ID: <3EF0A8D9.5070301@RedHat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 131 bytes --]
Reworked the diagnostics of nfsstat so warnings
are not displayed for statistics that are not
asked for and don't exist.
SteveD.
[-- Attachment #2: nfs-utils-1.0.3-04-nfsstat-gooddiags.patch --]
[-- Type: text/plain, Size: 1327 bytes --]
--- nfs-utils-1.0.1/utils/nfsstat/nfsstat.c.org 2002-05-05 19:33:30.000000000 -0400
+++ nfs-utils-1.0.1/utils/nfsstat/nfsstat.c 2003-01-07 16:01:02.000000000 -0500
@@ -124,6 +124,8 @@
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 @@
"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) {
@@ -338,8 +356,8 @@
* 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) {
next reply other threads:[~2003-06-18 17:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-18 18:00 Steve Dickson [this message]
2003-07-02 6:52 ` [PATCH] nfs-utils - 4 of 6 - nfsstat - removed needless warning Neil Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3EF0A8D9.5070301@RedHat.com \
--to=steved@redhat.com \
--cc=nfs@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox