NetBSD Problem Report #24850
Received: (qmail 8137 invoked by uid 605); 19 Mar 2004 14:31:09 -0000
Message-Id: <20040319143107.B2E1911152@narn.netbsd.org>
Date: Fri, 19 Mar 2004 14:31:07 +0000 (UTC)
From: jeffi@rcn.com
Sender: gnats-bugs-owner@NetBSD.org
Reply-To: jeffi@rcn.com
To: gnats-bugs@gnats.NetBSD.org
Subject: suppress sa(8) output when file(s) are non-existent
X-Send-Pr-Version: www-1.0
>Number: 24850
>Category: bin
>Synopsis: suppress sa(8) output when file(s) are non-existent
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Fri Mar 19 14:32:00 +0000 2004
>Closed-Date:
>Last-Modified:
>Originator: Jeff Ito
>Release: 1.6ZK
>Organization:
>Environment:
NetBSD lab 1.6ZK NetBSD 1.6ZK (LAB) #4: Tue Mar 9 22:03:23 EST 2004 jeff@netbsd:/q/nbsd/src/sys/arch/i386/compile/LAB i386
>Description:
sa(8) prints statistics, even if none the file arguments (default or passed via command line) exist. I don't believe this to be necessary.
>How-To-Repeat:
{265} sa
sa: open /var/account/acct read-only: No such file or directory
0 0.00re 0.00cp 0avio 0k
{266} sa test test2
sa: open test read-only: No such file or directory
sa: open test2 read-only: No such file or directory
0 0.00re 0.00cp 0avio 0k
>Fix:
Index: main.c
===================================================================
RCS file: /cvs/nbsd/src/usr.sbin/sa/main.c,v
retrieving revision 1.19
diff -u -r1.19 main.c
--- main.c 13 Feb 2004 11:36:24 -0000 1.19
+++ main.c 19 Mar 2004 14:15:56 -0000
@@ -88,8 +88,9 @@
char **argv;
{
int ch;
- int error;
+ int error, filefound;
+ filefound = 0;
error = 0;
while ((ch = getopt(argc, argv, "abcdDfijkKlmnqrstuv:")) != -1)
switch (ch) {
@@ -216,6 +217,8 @@
if (fd < 0)
continue;
+ filefound = 1;
+
if (!uflag && sflag) {
#ifndef DEBUG
sigset_t nmask, omask;
@@ -275,6 +278,10 @@
warn("close %s", *argv);
error = 1;
}
+ }
+
+ if (!filefound) {
+ exit(error);
}
if (!uflag && !qflag) {
>Release-Note:
>Audit-Trail:
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.