kern/104389: sys/geom/geom_dump.c doesn't encode XML entities

Poul-Henning Kamp phk at phk.freebsd.dk
Sun Oct 15 11:20:24 PDT 2006


The following reply was made to PR kern/104389; it has been noted by GNATS.

From: "Poul-Henning Kamp" <phk at phk.freebsd.dk>
To: douglas steinwand <dzs-pr at dzs.fx.org>
Cc: freebsd-gnats-submit at FreeBSD.org
Subject: Re: kern/104389: sys/geom/geom_dump.c doesn't encode XML entities 
Date: Sun, 15 Oct 2006 18:12:56 +0000

 In message <200610132043.k9DKh3lW055022 at www.freebsd.org>, douglas steinwand wri
 tes:
 
 >geom_dump.c should encode XML entities. Attached is a patch.
 
 I don't like it in two ways.
 
 I'm not keep on the encoding, and would be inclined to say
 "Don't use such names then", but I can probably be convinced
 that this is actually a good idea if sensible examples are shown.
 
 The other thing is that in the patch, the _encode_entities()
 function should not have a leading underscore and should
 take arguments:
 
 	static void
 	encode_entities(struct sbuf *sb, const char *fmt,
 	    const char *str, int len);
 
 So that usage would not need a randomsized local buffer and
 double enveloping of the call:
 
 >-	sbuf_printf(sb, "\t  <name>%s</name>\n", pp->name);
 
 Should be:
 
 	encode_entities(sb, "\t  <name>%s</name>\n", pp->name, -1);
 
 (-1 for len means "use strlen")
 
 
 -- 
 Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
 phk at FreeBSD.ORG         | TCP/IP since RFC 956
 FreeBSD committer       | BSD since 4.3-tahoe    
 Never attribute to malice what can adequately be explained by incompetence.


More information about the freebsd-geom mailing list