diff --git a/clients/lcdproc/machine_Linux.c b/clients/lcdproc/machine_Linux.c index 2e53fea..d197ff2 100644 --- a/clients/lcdproc/machine_Linux.c +++ b/clients/lcdproc/machine_Linux.c @@ -497,8 +497,16 @@ int machine_get_smpload(load_type *result, int *numcpus) int machine_get_uptime(double *up, double *idle) { + double local_up, local_idle; + reread(uptime_fd, "get_uptime:"); - sscanf(procbuf, "%lf %lf", up, idle); + sscanf(procbuf, "%lf %lf", &local_up, &local_idle); + if (up != NULL) + *up = local_up; + if (idle != NULL) + *idle = (local_up != 0) + ? 100 * local_idle / local_up + : 100; return(TRUE); }