mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-01-27 00:58:36 +00:00
Fix inotify segfault (sf.net #2804886).
Fix segfault due to bad checking of return values for inotify code (sf.net #2804886)
This commit is contained in:
parent
1933df5f31
commit
ca340d2643
@ -1,5 +1,7 @@
|
||||
2009-06-13
|
||||
* Added support for $to_bytes
|
||||
* Fix segfault due to bad checking of return values for inotify code
|
||||
(sf.net #2804886)
|
||||
|
||||
2009-06-12
|
||||
* Added support for per-task I/O statistics - $top_io
|
||||
|
@ -6851,7 +6851,7 @@ static void main_loop(void)
|
||||
#endif
|
||||
double t;
|
||||
#ifdef HAVE_SYS_INOTIFY_H
|
||||
int inotify_config_wd = 0;
|
||||
int inotify_config_wd = -1;
|
||||
#define INOTIFY_EVENT_SIZE (sizeof(struct inotify_event))
|
||||
#define INOTIFY_BUF_LEN (20 * (INOTIFY_EVENT_SIZE + 16))
|
||||
char inotify_buff[INOTIFY_BUF_LEN];
|
||||
@ -7184,12 +7184,12 @@ static void main_loop(void)
|
||||
break;
|
||||
}
|
||||
#ifdef HAVE_SYS_INOTIFY_H
|
||||
if (inotify_fd && !inotify_config_wd) {
|
||||
if (inotify_fd != -1 && inotify_config_wd != -1) {
|
||||
inotify_config_wd = inotify_add_watch(inotify_fd,
|
||||
current_config,
|
||||
IN_MODIFY);
|
||||
}
|
||||
if (inotify_fd && inotify_config_wd) {
|
||||
if (inotify_fd != -1 && inotify_config_wd != -1) {
|
||||
int len = 0, idx = 0;
|
||||
fd_set descriptors;
|
||||
struct timeval time_to_wait;
|
||||
@ -7232,7 +7232,7 @@ static void main_loop(void)
|
||||
}
|
||||
|
||||
#ifdef HAVE_SYS_INOTIFY_H
|
||||
if (inotify_fd) {
|
||||
if (inotify_fd != -1) {
|
||||
inotify_rm_watch(inotify_fd, inotify_config_wd);
|
||||
close(inotify_fd);
|
||||
inotify_fd = inotify_config_wd = 0;
|
||||
|
@ -52,7 +52,7 @@ void llua_load(const char *script)
|
||||
ERR("llua_load: %s", lua_tostring(lua_L, -1));
|
||||
lua_pop(lua_L, 1);
|
||||
#ifdef HAVE_SYS_INOTIFY_H
|
||||
} else if (!llua_block_notify && inotify_fd) {
|
||||
} else if (!llua_block_notify && inotify_fd != -1) {
|
||||
llua_append_notify(script);
|
||||
#endif /* HAVE_SYS_INOTIFY_H */
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user