Re: [Qemu-devel] [PATCH v7 1/2] qemu-io: Use error_[gs]et_progname()

2019-04-25 Thread Thomas Huth
On 31/01/2019 17.46, Christophe Fergeau wrote:
> qemu-io reimplements itself what
> error_get_progname()/error_set_progname() already does.
> This commit switches it to use this API from qemu-error.h
> 
> Signed-off-by: Christophe Fergeau 
> Reviewed-by: Eric Blake 
> Reviewed-by: Stefan Hajnoczi 

This patch causes some qemu-iotests to fail now, e.g.:

cd tests/qemu-iotests
./check -qcow2 114
[...]
114 0s ... - output mismatch (see 114.out.bad)
--- /home/thuth/devel/qemu/tests/qemu-iotests/114.out   2019-04-23
16:43:12.0 +0200
+++ /home/thuth/tmp/qemu-build/tests/qemu-iotests/114.out.bad   2019-04-25
12:27:47.0 +0200
@@ -7,7 +7,7 @@
 cluster_size: 65536
 backing file: TEST_DIR/t.IMGFMT.base
 backing file format: foo
-can't open device TEST_DIR/t.qcow2: Could not open backing file:
Unknown driver 'foo'
+qemu-io: can't open device TEST_DIR/t.qcow2: Could not open backing
file: Unknown driver 'foo'
 no file open, try 'help open'
 read 4096/4096 bytes at offset 0
 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)

Could you please have a look?

 Thomas



[Qemu-devel] [PATCH v7 1/2] qemu-io: Use error_[gs]et_progname()

2019-01-31 Thread Christophe Fergeau
qemu-io reimplements itself what
error_get_progname()/error_set_progname() already does.
This commit switches it to use this API from qemu-error.h

Signed-off-by: Christophe Fergeau 
Reviewed-by: Eric Blake 
Reviewed-by: Stefan Hajnoczi 
---
No changes since v6

 qemu-io.c | 14 ++
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/qemu-io.c b/qemu-io.c
index 6df7731af4..2c52ac0ade 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -34,8 +34,6 @@
 
 #define CMD_NOFILE_OK   0x01
 
-static char *progname;
-
 static BlockBackend *qemuio_blk;
 static bool quit_qemu_io;
 
@@ -312,7 +310,7 @@ static char *get_prompt(void)
 static char prompt[FILENAME_MAX + 2 /*"> "*/ + 1 /*"\0"*/ ];
 
 if (!prompt[0]) {
-snprintf(prompt, sizeof(prompt), "%s> ", progname);
+snprintf(prompt, sizeof(prompt), "%s> ", error_get_progname());
 }
 
 return prompt;
@@ -525,7 +523,7 @@ int main(int argc, char **argv)
 #endif
 
 module_call_init(MODULE_INIT_TRACE);
-progname = g_path_get_basename(argv[0]);
+error_set_progname(argv[0]);
 qemu_init_exec_dir(argv[0]);
 
 qcrypto_init(_fatal);
@@ -580,10 +578,10 @@ int main(int argc, char **argv)
 break;
 case 'V':
 printf("%s version " QEMU_FULL_VERSION "\n"
-   QEMU_COPYRIGHT "\n", progname);
+   QEMU_COPYRIGHT "\n", error_get_progname());
 exit(0);
 case 'h':
-usage(progname);
+usage(error_get_progname());
 exit(0);
 case 'U':
 force_share = true;
@@ -600,13 +598,13 @@ int main(int argc, char **argv)
 imageOpts = true;
 break;
 default:
-usage(progname);
+usage(error_get_progname());
 exit(1);
 }
 }
 
 if ((argc - optind) > 1) {
-usage(progname);
+usage(error_get_progname());
 exit(1);
 }
 
-- 
2.20.1