Don't use `df' for noise gathering, because it gets upset when NFS
[become] / src / noise.c
index a469b13..e9c2e44 100644 (file)
@@ -1,10 +1,10 @@
 /* -*-c-*-
  *
- * $Id: noise.c,v 1.1 1997/08/07 09:45:26 mdw Exp $
+ * $Id: noise.c,v 1.4 1998/02/20 17:52:32 mdw Exp $
  *
  * Collection of environmental noise
  *
- * (c) 1997 EBI
+ * (c) 1998 EBI
  */
 
 /*----- Licensing notice --------------------------------------------------*
 /*----- Revision history --------------------------------------------------*
  *
  * $Log: noise.c,v $
+ * Revision 1.4  1998/02/20 17:52:32  mdw
+ * Don't use `df' for noise gathering, because it gets upset when NFS
+ * servers aren't responding.
+ *
+ * Revision 1.3  1998/01/12 16:46:19  mdw
+ * Fix copyright date.
+ *
+ * Revision 1.2  1997/08/20  16:19:57  mdw
+ * Fix test for `/dev/random' so that it doesn't close `stdin' if it fails!
+ *
  * Revision 1.1  1997/08/07 09:45:26  mdw
  * New source file added to acquire environmental noise and add it to the
  * randomness pool (see `rand.c').
@@ -196,7 +206,7 @@ void noise_acquire(void)
     unsigned char buff[64];
     ssize_t sz;
 
-    if ((fd = open("/dev/random", O_RDONLY) >= 0) &&
+    if ((fd = open("/dev/random", O_RDONLY)) >= 0 &&
        (f = fcntl(fd, F_GETFL, 0)) >= 0 &&
        fcntl(fd, F_SETFL, f | O_NONBLOCK) >= 0 &&
        (sz = read(fd, buff, sizeof(buff))) > 0) {
@@ -224,8 +234,8 @@ void noise_acquire(void)
 
   noise__shell("ps auxww");
   noise__shell("ps -ef");
-  noise__shell("df");
-  /* @noise__shell("netstat -a");@ -- takes too long */
+  /* @noise__shell("df");@ -- irritates NFS */
+  noise__shell("netstat -an");
 
   /* --- Get our resource usage to see if that's at all interesting --- */