[Pkg-utopia-maintainers] Bug#852815: /usr/bin/nm-online: "nm-online -x -q" always exits 1 (offline)
James McCoy
jamessan at debian.org
Fri Jan 27 17:31:59 UTC 2017
On Fri, Jan 27, 2017 at 10:12:18AM -0500, James McCoy wrote:
> I've been using "nm-online -x -q" as a test condition for a cron job,
> and as of the update to 1.6.0-1, this always exits with 1 even when
> "nmcli general status" shows State=connected, Connectivity=full.
>
> "nm-online -q" appears to work correctly.
In 1.4.4, nm-online would exit immediately when the state was a
connected state:
if ( state == NM_STATE_CONNECTED_LOCAL
|| state == NM_STATE_CONNECTED_SITE
|| state == NM_STATE_CONNECTED_GLOBAL) {
g_object_unref (client);
return 0;
}
However, in 1.6.0, the logic was moved to a separate function that's
called by the event loop and returns the status via the shared
OnlineData pointer. quit_if_connected executes the equivalent code from
above but doesn't from after doing so, therefore data->retval is
overwritten in the next branch.
} else {
if ( state == NM_STATE_CONNECTED_LOCAL
|| state == NM_STATE_CONNECTED_SITE
|| state == NM_STATE_CONNECTED_GLOBAL) {
data->retval = 0;
g_main_loop_quit (data->loop);
}
}
if (data->exit_no_nm && (state != NM_STATE_CONNECTING)) {
data->retval = 1;
g_main_loop_quit (data->loop);
}
Cheers,
--
James
GPG Key: 4096R/91BF BF4D 6956 BD5D F7B7 2D23 DFE6 91AE 331B A3DB
More information about the Pkg-utopia-maintainers
mailing list