summaryrefslogtreecommitdiffstats
path: root/sys/geom/geom_disk.c
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2014-01-09 11:13:03 +0000
committermav <mav@FreeBSD.org>2014-01-09 11:13:03 +0000
commit263d261fe55e7315883f0397f146339fa8ca3984 (patch)
treeffb87a4a79b9f7013b3c6f39621574b722f646ba /sys/geom/geom_disk.c
parent3b6d8c3206c5262da9ef00988dfdb8a2b7863170 (diff)
downloadFreeBSD-src-263d261fe55e7315883f0397f146339fa8ca3984.zip
FreeBSD-src-263d261fe55e7315883f0397f146339fa8ca3984.tar.gz
MFC r258683:
Escape special XML chars, returned by some devices, confusing XML parsers.
Diffstat (limited to 'sys/geom/geom_disk.c')
-rw-r--r--sys/geom/geom_disk.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c
index e0b9776..9f7f538 100644
--- a/sys/geom/geom_disk.c
+++ b/sys/geom/geom_disk.c
@@ -485,26 +485,36 @@ g_disk_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, struct g
bp->bio_length = DISK_IDENT_SIZE;
bp->bio_data = buf;
res = dp->d_getattr(bp);
- sbuf_printf(sb, "%s<ident>%s</ident>\n", indent,
+ sbuf_printf(sb, "%s<ident>", indent);
+ g_conf_printf_escaped(sb, "%s",
res == 0 ? buf: dp->d_ident);
+ sbuf_printf(sb, "</ident>\n");
bp->bio_attribute = "GEOM::lunid";
bp->bio_length = DISK_IDENT_SIZE;
bp->bio_data = buf;
- if (dp->d_getattr(bp) == 0)
- sbuf_printf(sb, "%s<lunid>%s</lunid>\n",
- indent, buf);
+ if (dp->d_getattr(bp) == 0) {
+ sbuf_printf(sb, "%s<lunid>", indent);
+ g_conf_printf_escaped(sb, "%s", buf);
+ sbuf_printf(sb, "</lunid>\n");
+ }
bp->bio_attribute = "GEOM::lunname";
bp->bio_length = DISK_IDENT_SIZE;
bp->bio_data = buf;
- if (dp->d_getattr(bp) == 0)
- sbuf_printf(sb, "%s<lunname>%s</lunname>\n",
- indent, buf);
+ if (dp->d_getattr(bp) == 0) {
+ sbuf_printf(sb, "%s<lunname>", indent);
+ g_conf_printf_escaped(sb, "%s", buf);
+ sbuf_printf(sb, "</lunname>\n");
+ }
g_destroy_bio(bp);
g_free(buf);
- } else
- sbuf_printf(sb, "%s<ident>%s</ident>\n", indent,
- dp->d_ident);
- sbuf_printf(sb, "%s<descr>%s</descr>\n", indent, dp->d_descr);
+ } else {
+ sbuf_printf(sb, "%s<ident>", indent);
+ g_conf_printf_escaped(sb, "%s", dp->d_ident);
+ sbuf_printf(sb, "</ident>\n");
+ }
+ sbuf_printf(sb, "%s<descr>", indent);
+ g_conf_printf_escaped(sb, "%s", dp->d_descr);
+ sbuf_printf(sb, "</descr>\n");
}
}
OpenPOWER on IntegriCloud