summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-02-07 19:39:48 +0100
committerThomas Haller <thaller@redhat.com>2017-02-07 19:42:30 +0100
commitec91f950b8130619c4c925dd1d23dd330c38435c (patch)
tree796a1b55d90dfd459bfaa6d71c06cd04732dcfaa
parentca5f915ac2bda6ecb2bce628f5f608a945a59cfd (diff)
downloadNetworkManager-ec91f950b8130619c4c925dd1d23dd330c38435c.tar.gz
nm-online: fix wrong assertion failure during nm-online
_return() assigns the return value @retval and asserts that currently no return-value is assigned -- in order not to overwrite a once set value. That requires, that we call _return() and exit the main-loop right away, without possibility to call _return() again. However, during client_properties_changed() we easily might receive the "notify" signal multiple times, and thus call quit_if_connected() and _return() multiple times. That would lead to a wrong assertion failure. Avoid that, by disconnecting the signal handler once we reach _return(). Fixes: f7875a42b0f3a58ce152ec53642ecbb993d3073b
-rw-r--r--clients/nm-online.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/clients/nm-online.c b/clients/nm-online.c
index bb7da015c3..ee0b5249ad 100644
--- a/clients/nm-online.c
+++ b/clients/nm-online.c
@@ -77,6 +77,7 @@ _return (OnlineData *data, int retval)
nm_assert (data->retval == EXIT_FAILURE_UNSPECIFIED);
data->retval = retval;
+ nm_clear_g_signal_handler (data->client, &data->client_notify_id);
g_main_loop_quit (data->loop);
}
@@ -297,7 +298,7 @@ main (int argc, char *argv[])
g_clear_pointer (&data.loop, g_main_loop_unref);
if (!data.quiet)
- _print_progress (-1, NM_MAX (0, data.end_timestamp_ms - _now_ms ()), data.retval == 0);
+ _print_progress (-1, NM_MAX (0, data.end_timestamp_ms - _now_ms ()), data.retval == EXIT_SUCCESS);
return data.retval;
}