From 143605a200f9d418d62d25d91b1477b1d91c0b18 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Wed, 6 Apr 2016 10:16:18 +0100 Subject: qemu-img: fix formatting of error message The error_reportf_err() will not automatically append a ': ' before adding its suffix, so we must include that in the message we pass it, otherwise we get a badly formatted message lacking whitespace: qemu-img: Could not open 'driver=nbd,host=127.0.0.1,port=6666,tls-creds=tls0'Failed to connect socket: Connection refused Signed-off-by: Daniel P. Berrange Reviewed-by: Eric Blake Signed-off-by: Kevin Wolf --- qemu-img.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qemu-img.c') diff --git a/qemu-img.c b/qemu-img.c index 06264d9..17c5cfd 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -256,7 +256,7 @@ static BlockBackend *img_open_opts(const char *optstr, options = qemu_opts_to_qdict(opts, NULL); blk = blk_new_open(NULL, NULL, options, flags, &local_err); if (!blk) { - error_reportf_err(local_err, "Could not open '%s'", optstr); + error_reportf_err(local_err, "Could not open '%s': ", optstr); return NULL; } blk_set_enable_write_cache(blk, !writethrough); -- cgit v1.1 From c229708848cc77b0277e7260f7e739d441c1d086 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Wed, 6 Apr 2016 12:12:06 +0100 Subject: block: initialize qcrypto API at startup Any programs which call the qcrypto APIs should ensure that qcrypto_init() has been called before anything else which can use crypto. Essentially this means right at the start of the main method before initializing anything else. This is important because some versions of gnutls/gcrypt require explicit initialization before use. Signed-off-by: Daniel P. Berrange Reviewed-by: Alex Bligh Tested-by: Alex Bligh Signed-off-by: Kevin Wolf --- qemu-img.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'qemu-img.c') diff --git a/qemu-img.c b/qemu-img.c index 17c5cfd..1697762 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -37,6 +37,7 @@ #include "block/block_int.h" #include "block/blockjob.h" #include "block/qapi.h" +#include "crypto/init.h" #include #define QEMU_IMG_VERSION "qemu-img version " QEMU_VERSION QEMU_PKGVERSION \ @@ -3486,6 +3487,11 @@ int main(int argc, char **argv) exit(EXIT_FAILURE); } + if (qcrypto_init(&local_error) < 0) { + error_reportf_err(local_error, "cannot initialize crypto: "); + exit(1); + } + module_call_init(MODULE_INIT_QOM); bdrv_init(); if (argc < 2) { -- cgit v1.1