diff options
author | Thomas Haller <thaller@redhat.com> | 2020-01-01 09:54:23 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2020-01-13 15:46:04 +0100 |
commit | cccfeb3891f8281ef2804343b54132d51ae42381 (patch) | |
tree | fbb3c6a697f7cd5dc3586729d9ff108f204d6fbd /clients/cli | |
parent | 9cc6d3a26df0a2e7860a06ee72e5e7ef1689ebb2 (diff) | |
download | NetworkManager-cccfeb3891f8281ef2804343b54132d51ae42381.tar.gz |
cli: don't use GIOChannel to watch plain file descriptor for nmc_readline_helper()
Diffstat (limited to 'clients/cli')
-rw-r--r-- | clients/cli/common.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/clients/cli/common.c b/clients/cli/common.c index 452f04f624..a5d9bcbb1a 100644 --- a/clients/cli/common.c +++ b/clients/cli/common.c @@ -864,7 +864,9 @@ readline_cb (char *line) } static gboolean -stdin_ready_cb (GIOChannel * io, GIOCondition condition, gpointer data) +stdin_ready_cb (int fd, + GIOCondition condition, + gpointer data) { rl_callback_read_char (); return TRUE; @@ -874,14 +876,17 @@ static char * nmc_readline_helper (const NmcConfig *nmc_config, const char *prompt) { - GIOChannel *io = NULL; - guint io_watch_id; + GSource *io_source; nmc_set_in_readline (TRUE); - io = g_io_channel_unix_new (STDIN_FILENO); - io_watch_id = g_io_add_watch (io, G_IO_IN, stdin_ready_cb, NULL); - g_io_channel_unref (io); + io_source = nm_g_unix_fd_source_new (STDIN_FILENO, + G_IO_IN, + G_PRIORITY_DEFAULT, + stdin_ready_cb, + NULL, + NULL); + g_source_attach (io_source, NULL); read_again: rl_string = NULL; @@ -930,7 +935,8 @@ read_again: rl_string = NULL; } - g_source_remove (io_watch_id); + nm_clear_g_source_inst (&io_source); + nmc_set_in_readline (FALSE); return rl_string; |