mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-28 13:00:45 +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:
parent
354e577b15
commit
ee8a9e6b0f
@ -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);
|
snprintf(path, 255, "%s%s/%s%d_input", dir, dev, type, n);
|
||||||
fd = open(path, O_RDONLY);
|
fd = open(path, O_RDONLY);
|
||||||
if (fd < 0) {
|
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));
|
"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;
|
double r;
|
||||||
struct sysfs *sf = (struct sysfs *)obj->data.opaque;
|
struct sysfs *sf = (struct sysfs *)obj->data.opaque;
|
||||||
|
|
||||||
if (!sf)
|
if (!sf || sf->fd < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
r = get_sysfs_info(&sf->fd, sf->arg,
|
r = get_sysfs_info(&sf->fd, sf->arg,
|
||||||
@ -1216,6 +1216,7 @@ void free_sysfs_sensor(struct text_object *obj)
|
|||||||
if (!sf)
|
if (!sf)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if(sf->fd >= 0)
|
||||||
close(sf->fd);
|
close(sf->fd);
|
||||||
free_and_zero(obj->data.opaque);
|
free_and_zero(obj->data.opaque);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user