@@ -63,6 +63,7 @@ static unsigned int show;
6363static mon_output_format_t output_format = mon_output_unset ;
6464
6565/* other globals */
66+ static GIOChannel * io_channel = NULL ;
6667static GMainLoop * mainloop = NULL ;
6768static guint timer_id = 0 ;
6869static 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 );
@@ -2119,7 +2126,10 @@ clean_up(crm_exit_t exit_code)
21192126 * message.
21202127 */
21212128 if (exit_code == CRM_EX_USAGE && (output_format == mon_output_console || output_format == mon_output_plain )) {
2122- fprintf (stderr , "%s" , g_option_context_get_help (context , TRUE, NULL ));
2129+ char * help = g_option_context_get_help (context , TRUE, NULL );
2130+
2131+ fprintf (stderr , "%s" , help );
2132+ free (help );
21232133 }
21242134
21252135 pcmk__free_arg_context (context );
0 commit comments