Use &error_fatal when initializing crypto on qemu-{img,io,nbd}

In addition to making the code simpler, this will replace the
long error messages:
  cannot initialize crypto: Unable to initialize GNUTLS library: [...]
  cannot initialize crypto: Unable to initialize gcrypt
with shorter messages:
  Unable to initialize GNUTLS library: [...]
  Unable to initialize gcrypt

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
Eduardo Habkost 2016-05-12 11:10:04 -03:00
parent 822ac12df0
commit e8f2d2722e
3 changed files with 3 additions and 12 deletions

View file

@ -3492,10 +3492,7 @@ int main(int argc, char **argv)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
if (qcrypto_init(&local_error) < 0) { qcrypto_init(&error_fatal);
error_reportf_err(local_error, "cannot initialize crypto: ");
exit(1);
}
module_call_init(MODULE_INIT_QOM); module_call_init(MODULE_INIT_QOM);
bdrv_init(); bdrv_init();

View file

@ -466,10 +466,7 @@ int main(int argc, char **argv)
progname = basename(argv[0]); progname = basename(argv[0]);
qemu_init_exec_dir(argv[0]); qemu_init_exec_dir(argv[0]);
if (qcrypto_init(&local_error) < 0) { qcrypto_init(&error_fatal);
error_reportf_err(local_error, "cannot initialize crypto: ");
exit(1);
}
module_call_init(MODULE_INIT_QOM); module_call_init(MODULE_INIT_QOM);
qemu_add_opts(&qemu_object_opts); qemu_add_opts(&qemu_object_opts);

View file

@ -527,10 +527,7 @@ int main(int argc, char **argv)
sa_sigterm.sa_handler = termsig_handler; sa_sigterm.sa_handler = termsig_handler;
sigaction(SIGTERM, &sa_sigterm, NULL); sigaction(SIGTERM, &sa_sigterm, NULL);
if (qcrypto_init(&local_err) < 0) { qcrypto_init(&error_fatal);
error_reportf_err(local_err, "cannot initialize crypto: ");
exit(1);
}
module_call_init(MODULE_INIT_QOM); module_call_init(MODULE_INIT_QOM);
qemu_add_opts(&qemu_object_opts); qemu_add_opts(&qemu_object_opts);