diff options
author | Eamon Walsh <ewalsh@tycho.nsa.gov> | 2011-05-26 17:31:00 -0400 |
---|---|---|
committer | Eamon Walsh <ewalsh@tycho.nsa.gov> | 2011-05-26 17:31:00 -0400 |
commit | f46d207a810394b7c526746b8c8725c19bdf0273 (patch) | |
tree | f12266651b2a64984d1caf393d18b8a1189a4def /src/track.c | |
parent | a6a6ea5acd44fb097d0cd876ea7717792aed1e45 (diff) |
track: Zero-initialize all messages to avoid sending stack garbage.
Diffstat (limited to 'src/track.c')
-rw-r--r-- | src/track.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/track.c b/src/track.c index 66c6a2b..9ee8cc5 100644 --- a/src/track.c +++ b/src/track.c @@ -67,7 +67,7 @@ send_to_server(void *buf, int size) /*** SESSION ENDED ***/ static void -session_teardown(void) +session_reset(void) { struct lin_message m = { LINPICKER_DESTROY_ALL }; send_to_server(&m, sizeof(m)); @@ -82,7 +82,7 @@ scan_window(xcb_connection_t *conn, xcb_window_t root, xcb_window_t win) xcb_get_geometry_cookie_t gcook; xcb_get_geometry_reply_t *grep; xcb_generic_error_t *e; - struct lin_message m; + struct lin_message m = { LINPICKER_UPDATE }; acook = xcb_get_window_attributes(conn, win); gcook = xcb_get_geometry(conn, win); @@ -102,7 +102,6 @@ scan_window(xcb_connection_t *conn, xcb_window_t root, xcb_window_t win) arep->_class == XCB_WINDOW_CLASS_INPUT_OUTPUT && arep->map_state == XCB_MAP_STATE_VIEWABLE) { - m.type = LINPICKER_UPDATE; m.view = win; m.flags = LINPICKER_FLAG_TOPMOST | LINPICKER_FLAG_SHOWN | LINPICKER_FLAG_POSITION | LINPICKER_FLAG_CREATE; m.x = grep->x; @@ -127,10 +126,9 @@ scan_windows(xcb_connection_t *conn, xcb_window_t root) { xcb_get_geometry_cookie_t *gcook; xcb_get_geometry_reply_t *grep; unsigned int n, i; - struct lin_message m; /* destroy all current views */ - m.type = LINPICKER_DESTROY_ALL; + struct lin_message m = { LINPICKER_DESTROY_ALL }; send_to_server(&m, sizeof(m)); m.type = LINPICKER_UPDATE; @@ -392,7 +390,7 @@ main(int argc, char **argv) eventloop(conn, root); /* kill everything */ - session_teardown(); + session_reset(); libvchan_close(ctrl); return 0; } |