Package: conky / 1.9.0-6

fix-uninitialized-inotify_fd-value.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Description: Set uninitialized inotify_fd to -1, not 0
 Currently we set inotify_fd to the value 0 when inotify_fd hasn't been
 created yet, or after we close it. But 0 is a valid fd, and we check
 for the value -1 to see if it's been initialized. So, if inotify
 support is compiled in, but we disable_auto_reload, we can end up
 closing fd 0. This can screw up various other things in weird ways,
 including that exec'd processes appear to have an invalid stdin.
 .
 So, set inotify_fd to -1 to clear all of this up.
Origin: upstream, https://github.com/brndnmtthws/conky/commit/b458ebb100468488298691eb38c97673a69d894b
Author: Andrew Deason <adeason@dson.org>
Bug: https://github.com/brndnmtthws/conky/pull/23
Bug-Debian: http://bugs.debian.org/720112

--- a/src/conky.c
+++ b/src/conky.c
@@ -3464,7 +3464,7 @@
 }
 
 #ifdef HAVE_SYS_INOTIFY_H
-int inotify_fd;
+int inotify_fd = -1;
 #endif
 
 static void main_loop(void)
@@ -3923,7 +3923,7 @@
 		} else if (disable_auto_reload && inotify_fd != -1) {
 			inotify_rm_watch(inotify_fd, inotify_config_wd);
 			close(inotify_fd);
-			inotify_fd = inotify_config_wd = 0;
+			inotify_fd = inotify_config_wd = -1;
 		}
 #endif /* HAVE_SYS_INOTIFY_H */
 
@@ -3938,7 +3938,7 @@
 	if (inotify_fd != -1) {
 		inotify_rm_watch(inotify_fd, inotify_config_wd);
 		close(inotify_fd);
-		inotify_fd = inotify_config_wd = 0;
+		inotify_fd = inotify_config_wd = -1;
 	}
 #endif /* HAVE_SYS_INOTIFY_H */
 }