From 6465b5a730a285a6e57b87de3004b5cfa1668e01 Mon Sep 17 00:00:00 2001 From: reinelt <> Date: Tue, 13 Mar 2001 08:34:15 +0000 Subject: [lcd4linux @ 2001-03-13 08:34:15 by reinelt] corrected a off-by-one bug with sensors --- system.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'system.c') diff --git a/system.c b/system.c index cbf1bfe..a1a9b1c 100644 --- a/system.c +++ b/system.c @@ -1,4 +1,4 @@ -/* $Id: system.c,v 1.22 2001/03/12 12:39:36 reinelt Exp $ +/* $Id: system.c,v 1.23 2001/03/13 08:34:15 reinelt Exp $ * * system status retreivement * @@ -20,6 +20,10 @@ * * * $Log: system.c,v $ + * Revision 1.23 2001/03/13 08:34:15 reinelt + * + * corrected a off-by-one bug with sensors + * * Revision 1.22 2001/03/12 12:39:36 reinelt * * reworked autoconf a lot: drivers may be excluded, #define's went to config.h @@ -730,14 +734,14 @@ int Sensor (int index, double *val, double *min, double *max) { char buffer[32]; double dummy, value; - static int fd[SENSORS]={[0 ... SENSORS-1]=-2,}; - static char *sensor[SENSORS]={NULL,}; - static double val_buf[SENSORS]={0.0,}; - static double min_buf[SENSORS]={0.0,}; - static double max_buf[SENSORS]={0.0,}; - static time_t now[SENSORS]={0,}; - - if (index<1 || index>=SENSORS) return -1; + static int fd[SENSORS+1]={[0 ... SENSORS]=-2,}; + static char *sensor[SENSORS+1]={NULL,}; + static double val_buf[SENSORS+1]={0.0,}; + static double min_buf[SENSORS+1]={0.0,}; + static double max_buf[SENSORS+1]={0.0,}; + static time_t now[SENSORS+1]={0,}; + + if (index<0 || index>SENSORS) return -1; *val=val_buf[index]; *min=min_buf[index]; -- cgit v1.2.3