Skip to content

Commit 2f9c7bb

Browse files
committed
Fix: tools: Close the channel created with g_io_channel_unix_new.
1 parent 3e47794 commit 2f9c7bb

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

tools/crm_mon.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ static unsigned int show;
6363
static mon_output_format_t output_format = mon_output_unset;
6464

6565
/* other globals */
66+
static GIOChannel *io_channel = NULL;
6667
static GMainLoop *mainloop = NULL;
6768
static guint timer_id = 0;
6869
static mainloop_timer_t *refresh_timer = NULL;
@@ -1377,14 +1378,20 @@ main(int argc, char **argv)
13771378
if (ncurses_winch_handler == SIG_DFL ||
13781379
ncurses_winch_handler == SIG_IGN || ncurses_winch_handler == SIG_ERR)
13791380
ncurses_winch_handler = NULL;
1380-
g_io_add_watch(g_io_channel_unix_new(STDIN_FILENO), G_IO_IN, detect_user_input, NULL);
1381+
1382+
io_channel = g_io_channel_unix_new(STDIN_FILENO);
1383+
g_io_add_watch(io_channel, G_IO_IN, detect_user_input, NULL);
13811384
}
13821385
#endif
13831386
refresh_trigger = mainloop_add_trigger(G_PRIORITY_LOW, mon_refresh_display, NULL);
13841387

13851388
g_main_loop_run(mainloop);
13861389
g_main_loop_unref(mainloop);
13871390

1391+
if (io_channel != NULL) {
1392+
g_io_channel_shutdown(io_channel, TRUE, NULL);
1393+
}
1394+
13881395
crm_info("Exiting %s", crm_system_name);
13891396

13901397
return clean_up(CRM_EX_OK);

0 commit comments

Comments
 (0)