Commit dd3ca102 authored by Thomas Haller's avatar Thomas Haller Committed by Lubomir Rintel

platform: fix nm_platform_qdisc_to_string()

When using nm_utils_strbuf_*() API, the buffer gets always moved to the current
end. We must thus remember and return the original start of the buffer.

(cherry picked from commit b658e3da)
parent ef2b660b
......@@ -6427,10 +6427,13 @@ const char *
nm_platform_qdisc_to_string (const NMPlatformQdisc *qdisc, char *buf, gsize len)
{
char str_dev[TO_STRING_DEV_BUF_SIZE];
const char *buf0;
if (!nm_utils_to_string_buffer_init_null (qdisc, &buf, &len))
return buf;
buf0 = buf;
nm_utils_strbuf_append (&buf, &len, "%s%s family %u handle %x parent %x info %x",
qdisc->kind,
_to_string_dev (NULL, qdisc->ifindex, str_dev, sizeof (str_dev)),
......@@ -6458,7 +6461,7 @@ nm_platform_qdisc_to_string (const NMPlatformQdisc *qdisc, char *buf, gsize len)
nm_utils_strbuf_append (&buf, &len, " ecn");
}
return buf;
return buf0;
}
void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment