Hi Daniel,
On Wed, Jun 5, 2019 at 1:41 PM Daniel Wagner <wagi(a)monom.org> wrote:
Hi Yasser,
On Mon, May 27, 2019 at 11:32:58AM +0200, Yasser wrote:
> We had a crash in connman_network_set_connected() when
> disconnect_callback() was called but the value of wifi->network was
> not checked. This has already been fixed for wifi.c. However
> connman_network_set_connected() is called by other components where
> the network parameter is not checked beforehand so we thought it might
> be a good idea to verify in the function itself.
(commit message should be written differently)
So this code is not needed after all? I am relunctant to add checks
which are not necessary and will paper over problems.
No, it is not needed. It seemed like a good idea to have consistency in the code
since this function is called in other files (bluetooth.c, ethernet.c, etc)
and there this check is not always done.
>
> diff --git a/src/network.c b/src/network.c
> index 56fe24f..0486fad 100644
> --- a/src/network.c
> +++ b/src/network.c
> @@ -1675,6 +1675,9 @@ void connman_network_set_error(struct
> connman_network *network,
> int connman_network_set_connected(struct connman_network *network,
> bool connected)
> {
> + if (!network)
> + return 0;
> +
> DBG("network %p connected %d/%d connecting %d associating %d",
> network, network->connected, connected, network->connecting,
> network->associating);
BTW, the other patch I just applied was corrupted. This one looks also
whitespace damaged.
Sorry about that, I will run "git diff --check" before sending a patch
next time.
Thanks,
Daniel
Thanks for your comments.
Yasser