Skip to contentSkip to conversation

libmultipath: fix printing native nvme multipath topology.

PATCH In review Benjamin Marzinski 2 participants 2 messages Feb 16, 2022 Device mapper

lore
Share & tools
lore

Benjamin Marzinski

author maintainer
#0 lore raw

PATCH 1/1 libmultipath: fix printing native nvme multipath topology.

Since commit 2f05df4 ("libmultipath: use strbuf in print.c"), when multipath prints the topology of native nvme devices, instead of printing the multipath device information, it prints "w [G]:d s". This is because nvme_style() switched from calling snprintf(), which supports format specifiers, to append_strbuf_str(), which doesn't, while still keeping the same string, "%%w [%%G]:%%d %%s". Remove the extra percent signs, since they don't need to be escaped in append_strbuf_str().

Fixes 2f05df4 ("libmultipath: use strbuf in print.c")
---
 libmultipath/foreign/nvme.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libmultipath/foreign/nvme.c +1 -1
index 499b881d..838e1164 100644
@@ -337,7 +337,7 @@ static int snprint_nvme_pg(const struct gen_pathgroup *gmp,
 static int nvme_style(__attribute__((unused)) const struct gen_multipath* gm,
 		      struct strbuf *buf, __attribute__((unused)) int verbosity)
 {
-	return append_strbuf_str(buf, "%%w [%%G]:%%d %%s");
+	return append_strbuf_str(buf, "%w [%G]:%d %s");
 }
 
 static const struct gen_multipath_ops nvme_map_ops = {
Signature · 6 lines
2.17.2

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Benjamin Marzinski

Since commit 2f05df4 ("libmultipath: use strbuf in print.c"), when multipath prints the topology of native nvme devices, instead of printing the multipath device information, it prints "w [G]:d s". This
is because nvme_style() switched from calling snprintf(), which supports
format specifiers, to append_strbuf_str(), which doesn't, while still keeping the same string, "%%w [%%G]:%%d %%s". Remove the extra percent
signs, since they don't need to be escaped in append_strbuf_str().

Quoted 2 lines
Fixes 2f05df4 ("libmultipath: use strbuf in print.c")

Oops, thanks a lot for catching this!

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel