[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [PATCH rhel6-branch 10/11] Make kickstart network command reconfigure device in installer (#668395)



> @@ -2181,4 +2229,80 @@ int wait_for_iface_activation(char *ifname) {
>      return 3;
>  }
>  
> +/*
> + * Wait for disconnection of iface by NetworkManager, return non-zero on error.
> + */
> +int wait_for_iface_disconnection(char *ifname) {
...
> +    devices = nm_client_get_devices(client);
> +    for (i = 0; i < devices->len; i++) {
> +        NMDevice *candidate = g_ptr_array_index(devices, i);
> +        const char *name = nm_device_get_iface(candidate);
> +        if (!strcmp(name, ifname)) {
> +            device = candidate;
> +            break;
> +        }
> +    }
> +    if (device == NULL) {
> +        logMessage(ERROR, "%s (%d): network device %s not found",
> +                   __func__, __LINE__, ifname);
> +        g_object_unref(client);
> +        return 3;
> +    }

I've seen this same idiom in a couple places now, so it really seems
like the sort of thing that could get turned into a function.

Also, don't you need to free devices somewhere?  It doesn't appear we do
anywhere else in anaconda, though, so maybe not.  I'm not sure how
nm_client_get_devices behaves.

- Chris


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]