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: f7875a42b0
This commit is contained in:
@@ -77,6 +77,7 @@ _return (OnlineData *data, int retval)
|
|||||||
nm_assert (data->retval == EXIT_FAILURE_UNSPECIFIED);
|
nm_assert (data->retval == EXIT_FAILURE_UNSPECIFIED);
|
||||||
|
|
||||||
data->retval = retval;
|
data->retval = retval;
|
||||||
|
nm_clear_g_signal_handler (data->client, &data->client_notify_id);
|
||||||
g_main_loop_quit (data->loop);
|
g_main_loop_quit (data->loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -297,7 +298,7 @@ main (int argc, char *argv[])
|
|||||||
g_clear_pointer (&data.loop, g_main_loop_unref);
|
g_clear_pointer (&data.loop, g_main_loop_unref);
|
||||||
|
|
||||||
if (!data.quiet)
|
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;
|
return data.retval;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user