]> granicus.if.org Git - fcron/commitdiff
handle the case of a non existent procfs for lavg
authorthib <thib>
Sun, 3 Sep 2000 19:03:10 +0000 (19:03 +0000)
committerthib <thib>
Sun, 3 Sep 2000 19:03:10 +0000 (19:03 +0000)
database.c

index 9049a7b4bc519dcb16537aafec84c7aa2e87d883..a5d99c4ec46ae15501fc5aa911703f71eb2a4f04 100644 (file)
@@ -22,7 +22,7 @@
  *  `LICENSE' that comes with the fcron source distribution.
  */
 
- /* $Id: database.c,v 1.21 2000-09-03 14:32:19 thib Exp $ */
+ /* $Id: database.c,v 1.22 2000-09-03 19:03:10 thib Exp $ */
 
 #include "fcron.h"
 
@@ -719,8 +719,13 @@ get_lavg(short int l_avg[3])
     FILE *f = NULL;
     float fl = 0;
 
-    if ( (f = fopen(PROC "loadavg", "r")) == NULL )
+    if ( (f = fopen(PROC "loadavg", "r")) == NULL ) {
        error_e("could not open '"PROC"loadavg' (make sure /proc is mounted)");
+       l_avg[0] = 0;
+       l_avg[1] = 0;
+       l_avg[2] = 0;
+       return;
+    }
 
     fscanf(f, "%f", &fl);
     l_avg[0] = fl * 10;