diff options
| author | Roger Pau Monne <roger.pau@citrix.com> | 2025-01-10 10:35:31 +0100 |
|---|---|---|
| committer | David Woodhouse <dwmw@amazon.co.uk> | 2025-01-15 17:06:49 +0000 |
| commit | 7a0b74d8716836f1206c5dfd778984c5d6eee46b (patch) | |
| tree | e4c8e9a6de9460fb4a303ef6971c1ab8ac26c7fc /hw/char/xen_console.c | |
| parent | e6cdeee95990a2c6f5d6873d3afb3c90518aed5c (diff) | |
| download | focaccia-qemu-7a0b74d8716836f1206c5dfd778984c5d6eee46b.tar.gz focaccia-qemu-7a0b74d8716836f1206c5dfd778984c5d6eee46b.zip | |
xen: do not use '%ms' scanf specifier
The 'm' parameter used to request auto-allocation of the destination variable
is not supported on FreeBSD, and as such leads to failures to parse.
What's more, the current usage of '%ms' with xs_node_scanf() is pointless, as
it just leads to a double allocation of the same string. Instead use
xs_node_read() to read the whole xenstore node.
Fixes: a783f8ad4ec9 ('xen: add a mechanism to automatically create XenDevice-s...')
Fixes: 9b7737469080 ('hw/xen: update Xen console to XenDevice model')
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
Diffstat (limited to 'hw/char/xen_console.c')
| -rw-r--r-- | hw/char/xen_console.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/hw/char/xen_console.c b/hw/char/xen_console.c index ef0c2912ef..cb39b21504 100644 --- a/hw/char/xen_console.c +++ b/hw/char/xen_console.c @@ -550,7 +550,8 @@ static void xen_console_device_create(XenBackendInstance *backend, goto fail; } - if (xs_node_scanf(xsh, XBT_NULL, fe, "type", errp, "%ms", &type) != 1) { + type = xs_node_read(xsh, XBT_NULL, NULL, errp, "%s/%s", fe, "type"); + if (!type) { error_prepend(errp, "failed to read console device type: "); goto fail; } @@ -568,7 +569,8 @@ static void xen_console_device_create(XenBackendInstance *backend, snprintf(label, sizeof(label), "xencons%ld", number); - if (xs_node_scanf(xsh, XBT_NULL, fe, "output", NULL, "%ms", &output) == 1) { + output = xs_node_read(xsh, XBT_NULL, NULL, NULL, "%s/%s", fe, "output"); + if (output) { /* * FIXME: sure we want to support implicit * muxed monitors here? |