mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-17 18:45:10 +00:00
clear conky vars on disconnect/failure to open files
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@820 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
parent
c7f9e4033a
commit
302fae854c
@ -1,5 +1,8 @@
|
||||
# $Id$
|
||||
|
||||
2006-12-26
|
||||
* Clear conky vars on disconnect/failure to open files.
|
||||
|
||||
2006-12-23
|
||||
* Updated to libmpdclient 0.12.0
|
||||
|
||||
|
15
src/linux.c
15
src/linux.c
@ -75,6 +75,7 @@ void update_uptime()
|
||||
|
||||
if (!(fp = open_file("/proc/uptime", &rep)))
|
||||
{
|
||||
info.uptime=0.0;
|
||||
return;
|
||||
}
|
||||
fscanf(fp, "%lf", &info.uptime);
|
||||
@ -149,7 +150,10 @@ inline void update_net_stats()
|
||||
|
||||
/* open file and ignore first two lines */
|
||||
if (!(net_dev_fp = open_file("/proc/net/dev", &rep)))
|
||||
{
|
||||
clear_net_stats ();
|
||||
return;
|
||||
}
|
||||
|
||||
fgets(buf, 255, net_dev_fp); /* garbage */
|
||||
fgets(buf, 255, net_dev_fp); /* garbage (field names) */
|
||||
@ -326,6 +330,7 @@ void update_total_processes()
|
||||
|
||||
if (!(fp = open_file("/proc/loadavg", &rep)))
|
||||
{
|
||||
info.procs=0;
|
||||
return;
|
||||
}
|
||||
fscanf(fp, "%*f %*f %*f %*d/%hd", &info.procs );
|
||||
@ -428,7 +433,14 @@ inline static void update_stat()
|
||||
}
|
||||
|
||||
if (!(stat_fp = open_file("/proc/stat", &rep)))
|
||||
{
|
||||
info.run_procs=0;
|
||||
if (info.cpu_usage)
|
||||
{
|
||||
memset(info.cpu_usage, 0, info.cpu_count * sizeof (float));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
index = 0;
|
||||
while (!feof(stat_fp)) {
|
||||
@ -1519,7 +1531,10 @@ void update_diskio()
|
||||
int col_count = 0;
|
||||
|
||||
if (!(fp =open_file("/proc/diskstats", &rep)))
|
||||
{
|
||||
diskio_value=0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* read reads and writes from all disks (minor = 0), including
|
||||
* cd-roms and floppies, and summ them up
|
||||
|
Loading…
Reference in New Issue
Block a user