From ec91f950b8130619c4c925dd1d23dd330c38435c Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 7 Feb 2017 19:39:48 +0100 Subject: [PATCH] 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 --- clients/nm-online.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clients/nm-online.c b/clients/nm-online.c index bb7da015c..ee0b5249a 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; }