[systemd-devel] [PATCH] networkd: use valid bus paths

Tom Gundersen teg at jklm.no
Sun Feb 8 07:34:36 PST 2015


Applied. Thanks!

On Fri, Feb 6, 2015 at 9:35 PM, Mantas Mikulėnas <grawity at gmail.com> wrote:
> Object path components must start with [A-Za-z_] (AFAIK).
> Also the value of 'p' is undefined if asprintf fails.
> Compare to user_bus_path() in src/login/logind-user-dbus.c:281.
> ---
>  src/network/networkd-link-bus.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/network/networkd-link-bus.c b/src/network/networkd-link-bus.c
> index f7eae87..7c4f473 100644
> --- a/src/network/networkd-link-bus.c
> +++ b/src/network/networkd-link-bus.c
> @@ -43,7 +43,8 @@ static char *link_bus_path(Link *link) {
>          assert(link);
>          assert(link->ifindex > 0);
>
> -        asprintf(&p, "/org/freedesktop/network1/link/%d", link->ifindex);
> +        if (asprintf(&p, "/org/freedesktop/network1/link/_%d", link->ifindex) < 0)
> +                return NULL;
>
>          return p;
>  }
> @@ -89,7 +90,7 @@ int link_object_find(sd_bus *bus, const char *path, const char *interface, void
>          assert(m);
>          assert(found);
>
> -        if (sscanf(path, "/org/freedesktop/network1/link/%d", &ifindex) != 1)
> +        if (sscanf(path, "/org/freedesktop/network1/link/_%d", &ifindex) != 1)
>                  return 0;
>
>          r = link_get(m, ifindex, &link);
> --
> 2.3.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