aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Magenheimer <dan.magenheimer@oracle.com>2012-11-14 12:06:00 +0000
committerDan Magenheimer <dan.magenheimer@oracle.com>2012-11-14 12:06:00 +0000
commit86d10f2be082fe47149d27e31c6c0824a31ff4fb (patch)
treefb4616e3984c5f145cfac10a38d6e7eb668103c3
parent45cc0581c6515105147fbc27339d056e02782efb (diff)
downloadxen-86d10f2be082fe47149d27e31c6c0824a31ff4fb.tar.gz
xen-86d10f2be082fe47149d27e31c6c0824a31ff4fb.tar.bz2
xen-86d10f2be082fe47149d27e31c6c0824a31ff4fb.zip
xen-tmem-list-parse: fix ugly parse output
The program xen-tmem-list-parse parses the output of xm/xl tmem-list into human-readable format. A missing NULL terminator sometimes causes garbage to be spewed where the two-letter pool type should be output. Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com> xen-unstable changeset: 26147:3186c04af582 Backport-requested-by: Dan Magenheimer <dan.magenheimer@oracle.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
-rw-r--r--tools/misc/xen-tmem-list-parse.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/misc/xen-tmem-list-parse.c b/tools/misc/xen-tmem-list-parse.c
index 977e4d3cc2..f32b107dce 100644
--- a/tools/misc/xen-tmem-list-parse.c
+++ b/tools/misc/xen-tmem-list-parse.c
@@ -243,6 +243,7 @@ void parse_pool(char *s)
unsigned long long flush_objs = parse(s,"ot");
parse_string(s,"PT",pool_type,2);
+ pool_type[2] = '\0';
if (pool_type[1] == 'S')
return; /* no need to repeat print data for shared pools */
printf("domid%lu,id%lu[%s]:pgp=%llu(max=%llu) obj=%llu(%llu) "
@@ -286,6 +287,7 @@ void parse_shared_pool(char *s)
unsigned long long flush_objs = parse(s,"ot");
parse_string(s,"PT",pool_type,2);
+ pool_type[2] = '\0';
parse_sharers(s,"SC",buf,BUFSIZE);
printf("poolid=%lu[%s] uuid=%llx.%llx, shared-by:%s: "
"pgp=%llu(max=%llu) obj=%llu(%llu) "