1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-15 17:47:09 +00:00

Fix LP: #525926; conky sigsegv if config file is deleted

Basically, we only relod if the file is modified but still handle the case
where the watch gets lost. Maybe we should just ignore IN_IGNORE altogether?
(cherry picked from commit 085c39d394)
This commit is contained in:
Cesare Tirabassi 2010-02-22 22:45:51 +01:00
parent 29f013b34d
commit 8ca6ea6aec

View File

@ -3915,10 +3915,12 @@ static void main_loop(void)
len = read(inotify_fd, inotify_buff, INOTIFY_BUF_LEN); len = read(inotify_fd, inotify_buff, INOTIFY_BUF_LEN);
while (len > 0 && idx < len) { while (len > 0 && idx < len) {
struct inotify_event *ev = (struct inotify_event *) &inotify_buff[idx]; struct inotify_event *ev = (struct inotify_event *) &inotify_buff[idx];
if (ev->wd == inotify_config_wd && (ev->mask & IN_MODIFY || ev->mask & IN_IGNORED)) { if (ev->wd == inotify_config_wd) {
/* current_config should be reloaded */ if (ev->mask & IN_MODIFY) {
NORM_ERR("'%s' modified, reloading...", current_config); /* current_config should be reloaded */
reload_config(); NORM_ERR("'%s' modified, reloading...", current_config);
reload_config();
}
if (ev->mask & IN_IGNORED) { if (ev->mask & IN_IGNORED) {
/* for some reason we get IN_IGNORED here /* for some reason we get IN_IGNORED here
* sometimes, so we need to re-add the watch */ * sometimes, so we need to re-add the watch */