libxl: re-implement libxl__xs_printf()
authorPaul Durrant <paul.durrant@citrix.com>
Tue, 1 Dec 2015 13:55:25 +0000 (13:55 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Tue, 15 Dec 2015 12:05:19 +0000 (12:05 +0000)
commita2552ad1b6f0487d96623c85702373d8b410a5ac
tree2924ee6ca3b94ecbc6cd4fb48c3fd1a7a373d726
parenta5361ebc6da596ad61e94b3fed1960bd46fac14a
libxl: re-implement libxl__xs_printf()

This patch adds a new libxl__xs_vprintf() which actually checks the
success of the underlying call to xs_write() (logging if it fails) and
then re-implements libxl__xs_printf() using this (and replacing the
call to vasprintf() with a call to libxl__vsprintf()).

libxl__xs_vprintf() is added to the 'checked' section of libxl_internal.h
and, since it now underpins libxl__xs_printf(), that declaration is
moved into the same section.

Looking at call sites of libxl__xs_printf() it seems as though several
of them expected a failure if the underlying xs_write() failed, so this
patch should actually fulfil the semantic that was intended all along.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/libxl/libxl_internal.h
tools/libxl/libxl_xshelp.c