summaryrefslogtreecommitdiffstats
path: root/compton.c
diff options
context:
space:
mode:
authorRichard Grenville <pyxlcy@gmail.com>2012-11-04 19:14:21 +0800
committerRichard Grenville <pyxlcy@gmail.com>2012-11-04 19:44:14 +0800
commitfe5537df9e3b3b443a8464c2df4e0a70c7900e2b (patch)
tree10565f3faf7135c2693162231f6b163e69a2d83a /compton.c
parent86103c5cebcd962156edebe7f58fec8786d84277 (diff)
downloadtdebase-fe5537df9e3b3b443a8464c2df4e0a70c7900e2b.tar.gz
tdebase-fe5537df9e3b3b443a8464c2df4e0a70c7900e2b.zip
Bug fix #61: Silence a warning
- Silence a FORTIFY_SOURCE warning. Thanks to @smlx for reporting. - Add -O2 -D_FORTIFY_SOURCE=2 to default CFLAGS in Makefile. - Use a cleaner way to resolve the writing-to-freed-memory issue mentioned in last commit.
Diffstat (limited to 'compton.c')
-rw-r--r--compton.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/compton.c b/compton.c
index 032f2d3ea..9b39fc83e 100644
--- a/compton.c
+++ b/compton.c
@@ -1526,21 +1526,19 @@ paint_preprocess(Display *dpy, win *list) {
}
+ // Avoid setting w->to_paint if w is to be freed
+ bool destroyed = (w->opacity_tgt == w->opacity && w->destroyed);
+
if (to_paint) {
w->prev_trans = t;
t = w;
- w->to_paint = to_paint;
}
else {
- // Avoid setting w->to_paint if w is to be freed
- if (!(w->opacity_tgt == w->opacity && w->destroyed)) {
- check_fade_fin(dpy, w);
- w->to_paint = to_paint;
- }
- else {
- check_fade_fin(dpy, w);
- }
+ check_fade_fin(dpy, w);
}
+
+ if (!destroyed)
+ w->to_paint = to_paint;
}
return t;
@@ -3567,9 +3565,11 @@ fork_after(void) {
setsid();
- freopen("/dev/null", "r", stdin);
- freopen("/dev/null", "w", stdout);
- freopen("/dev/null", "w", stderr);
+ // Mainly to suppress the _FORTIFY_SOURCE warning
+ if (!freopen("/dev/null", "r", stdin)
+ || !freopen("/dev/null", "w", stdout)
+ || !freopen("/dev/null", "w", stderr))
+ fprintf(stderr, "fork_after(): freopen() failed.");
}
#ifdef CONFIG_LIBCONFIG