mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-27 20:44:56 +00:00
Merge branch 'master' into lua-config
This commit is contained in:
commit
1b791ed1c8
@ -2012,7 +2012,7 @@ static void main_loop(void)
|
||||
#ifdef HAVE_SYS_INOTIFY_H
|
||||
int inotify_config_wd = -1;
|
||||
#define INOTIFY_EVENT_SIZE (sizeof(struct inotify_event))
|
||||
#define INOTIFY_BUF_LEN (20 * (INOTIFY_EVENT_SIZE + 16))
|
||||
#define INOTIFY_BUF_LEN (20 * (INOTIFY_EVENT_SIZE + 16)) + 1
|
||||
char inotify_buff[INOTIFY_BUF_LEN];
|
||||
#endif /* HAVE_SYS_INOTIFY_H */
|
||||
|
||||
@ -2420,7 +2420,8 @@ static void main_loop(void)
|
||||
select(inotify_fd + 1, &descriptors, NULL, NULL, &time_to_wait);
|
||||
if (FD_ISSET(inotify_fd, &descriptors)) {
|
||||
/* process inotify events */
|
||||
len = read(inotify_fd, inotify_buff, INOTIFY_BUF_LEN);
|
||||
len = read(inotify_fd, inotify_buff, INOTIFY_BUF_LEN - 1);
|
||||
inotify_buff[len] = 0;
|
||||
while (len > 0 && idx < len) {
|
||||
struct inotify_event *ev = (struct inotify_event *) &inotify_buff[idx];
|
||||
if (ev->wd == inotify_config_wd && (ev->mask & IN_MODIFY || ev->mask & IN_IGNORED)) {
|
||||
|
10
src/linux.cc
10
src/linux.cc
@ -2450,7 +2450,7 @@ static unsigned long long calc_cpu_total(void)
|
||||
KFLAG_ISSET(KFLAG_IS_LONGSTAT) ? TMPL_LONGPROC : TMPL_SHORTPROC;
|
||||
|
||||
ps = open("/proc/stat", O_RDONLY);
|
||||
rc = read(ps, line, sizeof(line));
|
||||
rc = read(ps, line, BUFFER_LEN - 1);
|
||||
close(ps);
|
||||
if (rc < 0) {
|
||||
return 0;
|
||||
@ -2529,7 +2529,7 @@ static void process_parse_stat(struct process *process)
|
||||
/* Mark process as up-to-date. */
|
||||
process->time_stamp = g_time;
|
||||
|
||||
rc = read(ps, line, sizeof(line));
|
||||
rc = read(ps, line, BUFFER_LEN - 1);
|
||||
close(ps);
|
||||
if (rc < 0) {
|
||||
return;
|
||||
@ -2566,11 +2566,9 @@ static void process_parse_stat(struct process *process)
|
||||
return;
|
||||
}
|
||||
|
||||
endl = read(ps, line, sizeof(line));
|
||||
endl = read(ps, line, BUFFER_LEN - 1);
|
||||
close(ps);
|
||||
|
||||
/* null terminate the input */
|
||||
line[endl] = 0;
|
||||
/* account for "kdeinit: " */
|
||||
if ((char *) line == strstr(line, "kdeinit: ")) {
|
||||
r = ((char *) line) + 9;
|
||||
@ -2641,7 +2639,7 @@ static void process_parse_io(struct process *process)
|
||||
return;
|
||||
}
|
||||
|
||||
rc = read(ps, line, sizeof(line));
|
||||
rc = read(ps, line, BUFFER_LEN - 1);
|
||||
close(ps);
|
||||
if (rc < 0) {
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user