1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-27 04:32:55 +00:00

Don't abort when config references a non-existant hwmon file

this sort of fixes sf.net #3306538. The person there correctly tested for the existance of the
file with $if_existing, but the problem is we run the callbacks regardless of the conditional
tests.
This commit is contained in:
Pavel Labath 2011-10-13 10:28:12 +02:00
parent 354e577b15
commit ee8a9e6b0f

View File

@ -1040,7 +1040,7 @@ static int open_sysfs_sensor(const char *dir, const char *dev, const char *type,
snprintf(path, 255, "%s%s/%s%d_input", dir, dev, type, n);
fd = open(path, O_RDONLY);
if (fd < 0) {
CRIT_ERR(NULL, NULL, "can't open '%s': %s\nplease check your device or remove this "
NORM_ERR("can't open '%s': %s\nplease check your device or remove this "
"var from "PACKAGE_NAME, path, strerror(errno));
}
}
@ -1192,7 +1192,7 @@ void print_sysfs_sensor(struct text_object *obj, char *p, int p_max_size)
double r;
struct sysfs *sf = (struct sysfs *)obj->data.opaque;
if (!sf)
if (!sf || sf->fd < 0)
return;
r = get_sysfs_info(&sf->fd, sf->arg,
@ -1216,7 +1216,8 @@ void free_sysfs_sensor(struct text_object *obj)
if (!sf)
return;
close(sf->fd);
if(sf->fd >= 0)
close(sf->fd);
free_and_zero(obj->data.opaque);
}