diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2014-10-19 11:06:10 +0200 |
---|---|---|
committer | Jiří Klimeš <jklimes@redhat.com> | 2014-10-20 10:05:59 +0200 |
commit | 461da6fe1a5e9b7080281055bf5d5fb23a1e9922 (patch) | |
tree | dd3aef9540900798376418ebd6ab3b72c7267c6d | |
parent | 9c6a510b929539fb0023c83207d8118e4235ed94 (diff) | |
download | NetworkManager-461da6fe1a5e9b7080281055bf5d5fb23a1e9922.tar.gz |
cli: fix getting/setting hostname (bgo #738796)
Create a client instance before it's used.
$ nmcli g hostname
(process:13615): GLib-GObject-CRITICAL **: g_object_get: assertion 'G_IS_OBJECT (object)' failed
https://bugzilla.gnome.org/show_bug.cgi?id=738796
-rw-r--r-- | clients/cli/general.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clients/cli/general.c b/clients/cli/general.c index 1da3803fc9..a4face54cc 100644 --- a/clients/cli/general.c +++ b/clients/cli/general.c @@ -594,6 +594,7 @@ do_general (NmCli *nmc, int argc, char **argv) /* no arguments -> get hostname */ char *hostname = NULL; + nmc->get_client (nmc); /* create NMClient */ g_object_get (nmc->client, NM_CLIENT_HOSTNAME, &hostname, NULL); if (hostname) g_print ("%s\n", hostname); @@ -606,6 +607,7 @@ do_general (NmCli *nmc, int argc, char **argv) g_print ("Warning: ignoring extra garbage after '%s' hostname\n", hostname); nmc->should_wait = TRUE; + nmc->get_client (nmc); /* create NMClient */ nm_client_save_hostname_async (nmc->client, hostname, NULL, save_hostname_cb, nmc); } } |