[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 5/6] xl: Use xasprintf for cpupoolnumsplit names
Otherwise we have to do complicated reasoning about the length that %d might produce. Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx> --- tools/libxl/xl_cmdimpl.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index c876d3e..4396095 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -7735,7 +7735,7 @@ int main_cpupoolnumasplit(int argc, char **argv) int n_pools; int node; int n_cpus; - char name[16]; + char *name = NULL; libxl_uuid uuid; libxl_bitmap cpumap; libxl_cpupoolinfo *poolinfo; @@ -7783,7 +7783,7 @@ int main_cpupoolnumasplit(int argc, char **argv) goto out; } - snprintf(name, 15, "Pool-node%d", node); + xasprintf(&name, "Pool-node%d", node); if (libxl_cpupool_rename(ctx, name, 0)) { fprintf(stderr, "error on renaming Pool 0\n"); goto out; @@ -7828,7 +7828,8 @@ int main_cpupoolnumasplit(int argc, char **argv) goto out; } - snprintf(name, 15, "Pool-node%d", node); + free(name); + xasprintf(&name, "Pool-node%d", node); libxl_uuid_generate(&uuid); poolid = 0; if (libxl_cpupool_create(ctx, name, sched, cpumap, &uuid, &poolid)) { @@ -7853,6 +7854,7 @@ int main_cpupoolnumasplit(int argc, char **argv) out: libxl_cputopology_list_free(topology, n_cpus); libxl_bitmap_dispose(&cpumap); + free(name); return rc; } -- 1.7.10.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |