For non-alias indexes prefix is an empty string, where
strbuf_pushchars() returns the number of characters added to the strbuf.
Since those are zero, we end up completely skipping the dump process.
Cc: Tobias Stoeckmann <tobias@stoeckmann.org>
Fixes: 889d02b1 ("libkmod: check strbuf return values")
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/224
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
return;
strbuf_init(&buf);
- if (strbuf_pushchars(&buf, prefix))
+ if (prefix[0] == '\0' || strbuf_pushchars(&buf, prefix))
index_dump_node(root, &buf, fd);
strbuf_release(&buf);
}
return;
strbuf_init(&buf);
- if (strbuf_pushchars(&buf, prefix))
+ if (prefix[0] == '\0' || strbuf_pushchars(&buf, prefix))
index_mm_dump_node(root, &buf, fd);
strbuf_release(&buf);
}