Subject: Re: iostat warnings in security report
To: Jared D. McNeill <jmcneill@invisible.ca>
From: Alex Plotnick <shrike@netaxs.com>
List: current-users
Date: 09/08/2005 20:56:20
Circa Thu, 08 Sep 2005 21:18:43 -0300, "Jared D. McNeill" thus spake:

> Do you think that iostat should warn about any type of drive not  
> attached? I wouldn't expect it to complain that I don't have a tape  
> drive, USB drive, SCSI drive, firewire drive, floppy drive, and a  
> tape drive attached everytime I ran it.

Ok; you're right.  I hadn't thought about it that way.  However, iostat
isn't actually doing the warning; it's in tpinit() from vmstat/tpstats.c.


Index: usr.bin/vmstat/tpstats.c
===================================================================
RCS file: /cvsroot/src/usr.bin/vmstat/tpstats.c,v
retrieving revision 1.2
diff -u -r1.2 tpstats.c
--- usr.bin/vmstat/tpstats.c	8 Aug 2005 11:31:48 -0000	1.2
+++ usr.bin/vmstat/tpstats.c	9 Sep 2005 00:46:04 -0000
@@ -187,7 +187,7 @@
 
 /*
  * Perform all of the initialization and memory allocation needed to
- * track disk statistics.
+ * track tape statistics.
  */
 int
 tpinit(int selected)
@@ -210,9 +210,7 @@
 
 		tp_ndrive = size / sizeof(struct tape_sysctl);
 
-		if (size == 0) {
-			warnx("No tape drives attached.");
-		} else {
+		if (size != 0) {
 			tapes = (struct tape_sysctl *)malloc(size);
 			if (tapes == NULL)
 				errx(1, "Memory allocation failure.");