[systemd-devel] [PATCH] silence warning
Tom Gundersen
teg at jklm.no
Fri Apr 11 14:57:52 PDT 2014
On Fri, Apr 11, 2014 at 10:17 PM, Thomas H.P. Andersen <phomes at gmail.com> wrote:
> From: Thomas Hindoe Paaboel Andersen <phomes at gmail.com>
>
> The error message logged in finish: will not be very informative
> but on the other hand I don't see how this should ever happen.
This can never happen, unless there is memory corruption (which
happened in the past and is why I added the check). I have now
replaced it with an assert. Thanks!
> ---
> src/network/networkd-link.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
> index 684e1e5..e9b30a3 100644
> --- a/src/network/networkd-link.c
> +++ b/src/network/networkd-link.c
> @@ -1518,8 +1518,10 @@ int link_save(Link *link) {
> assert(link->state_file);
>
> state = link_state_to_string(link->state);
> - if (!state)
> + if (!state) {
> + r = -EINVAL;
> goto finish;
> + }
>
> r = fopen_temporary(link->state_file, &f, &temp_path);
> if (r < 0)
> --
> 1.9.0
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
More information about the systemd-devel
mailing list