From: Thibault Godouet Date: Sun, 3 Sep 2000 19:03:10 +0000 (+0000) Subject: handle the case of a non existent procfs for lavg X-Git-Tag: ver2_9_4~606 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bfc33db0fe5b9575d21e5b3dbc75c6acdfcd8da5;p=thirdparty%2Ffcron.git handle the case of a non existent procfs for lavg --- diff --git a/database.c b/database.c index 9049a7b..a5d99c4 100644 --- a/database.c +++ b/database.c @@ -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;