[libvirt] [PATCH] virFileNBDDeviceAssociate: Avoid use of uninitialized variable
by Michal Privoznik
The @qemunbd variable can be used uninitialized.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Pushing under trivial and build breaker rules.
src/util/virfile.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/util/virfile.c b/src/util/virfile.c
index 2b07ac9..7af0843 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -732,7 +732,7 @@ int virFileNBDDeviceAssociate(const char *file,
char **dev)
{
char *nbddev;
- char *qemunbd;
+ char *qemunbd = NULL;
virCommandPtr cmd = NULL;
int ret = -1;
const char *fmtstr = NULL;
--
1.8.1.5
11 years, 3 months
[libvirt] [PATCH] Fix: Syle issues (daemon/remote.c)
by Nehal J Wani
Fix for argument layouts of various functions in daemon/remote.c. Refer:
https://www.redhat.com/archives/libvir-list/2013-September/msg00057.html
---
daemon/remote.c | 117 ++++++++++++++++++++++++++------------------------------
1 file changed, 55 insertions(+), 62 deletions(-)
diff --git a/daemon/remote.c b/daemon/remote.c
index 6ace7af..2aff7c1 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -3852,13 +3852,13 @@ cleanup:
return rv;
}
-static int remoteDispatchDomainGetDiskErrors(
- virNetServerPtr server ATTRIBUTE_UNUSED,
- virNetServerClientPtr client,
- virNetMessagePtr msg ATTRIBUTE_UNUSED,
- virNetMessageErrorPtr rerr,
- remote_domain_get_disk_errors_args *args,
- remote_domain_get_disk_errors_ret *ret)
+static int
+remoteDispatchDomainGetDiskErrors(virNetServerPtr server ATTRIBUTE_UNUSED,
+ virNetServerClientPtr client,
+ virNetMessagePtr msg ATTRIBUTE_UNUSED,
+ virNetMessageErrorPtr rerr,
+ remote_domain_get_disk_errors_args *args,
+ remote_domain_get_disk_errors_ret *ret)
{
int rv = -1;
virDomainPtr dom = NULL;
@@ -4674,13 +4674,12 @@ cleanup:
}
static int
-remoteDispatchDomainMigrateBegin3Params(
- virNetServerPtr server ATTRIBUTE_UNUSED,
- virNetServerClientPtr client ATTRIBUTE_UNUSED,
- virNetMessagePtr msg ATTRIBUTE_UNUSED,
- virNetMessageErrorPtr rerr,
- remote_domain_migrate_begin3_params_args *args,
- remote_domain_migrate_begin3_params_ret *ret)
+remoteDispatchDomainMigrateBegin3Params(virNetServerPtr server ATTRIBUTE_UNUSED,
+ virNetServerClientPtr client ATTRIBUTE_UNUSED,
+ virNetMessagePtr msg ATTRIBUTE_UNUSED,
+ virNetMessageErrorPtr rerr,
+ remote_domain_migrate_begin3_params_args *args,
+ remote_domain_migrate_begin3_params_ret *ret)
{
char *xml = NULL;
virDomainPtr dom = NULL;
@@ -4733,13 +4732,12 @@ cleanup:
}
static int
-remoteDispatchDomainMigratePrepare3Params(
- virNetServerPtr server ATTRIBUTE_UNUSED,
- virNetServerClientPtr client ATTRIBUTE_UNUSED,
- virNetMessagePtr msg ATTRIBUTE_UNUSED,
- virNetMessageErrorPtr rerr,
- remote_domain_migrate_prepare3_params_args *args,
- remote_domain_migrate_prepare3_params_ret *ret)
+remoteDispatchDomainMigratePrepare3Params(virNetServerPtr server ATTRIBUTE_UNUSED,
+ virNetServerClientPtr client ATTRIBUTE_UNUSED,
+ virNetMessagePtr msg ATTRIBUTE_UNUSED,
+ virNetMessageErrorPtr rerr,
+ remote_domain_migrate_prepare3_params_args *args,
+ remote_domain_migrate_prepare3_params_ret *ret)
{
virTypedParameterPtr params = NULL;
int nparams = 0;
@@ -4794,13 +4792,12 @@ cleanup:
}
static int
-remoteDispatchDomainMigratePrepareTunnel3Params(
- virNetServerPtr server ATTRIBUTE_UNUSED,
- virNetServerClientPtr client,
- virNetMessagePtr msg,
- virNetMessageErrorPtr rerr,
- remote_domain_migrate_prepare_tunnel3_params_args *args,
- remote_domain_migrate_prepare_tunnel3_params_ret *ret)
+remoteDispatchDomainMigratePrepareTunnel3Params(virNetServerPtr server ATTRIBUTE_UNUSED,
+ virNetServerClientPtr client,
+ virNetMessagePtr msg,
+ virNetMessageErrorPtr rerr,
+ remote_domain_migrate_prepare_tunnel3_params_args *args,
+ remote_domain_migrate_prepare_tunnel3_params_ret *ret)
{
virTypedParameterPtr params = NULL;
int nparams = 0;
@@ -4865,13 +4862,12 @@ cleanup:
static int
-remoteDispatchDomainMigratePerform3Params(
- virNetServerPtr server ATTRIBUTE_UNUSED,
- virNetServerClientPtr client ATTRIBUTE_UNUSED,
- virNetMessagePtr msg ATTRIBUTE_UNUSED,
- virNetMessageErrorPtr rerr,
- remote_domain_migrate_perform3_params_args *args,
- remote_domain_migrate_perform3_params_ret *ret)
+remoteDispatchDomainMigratePerform3Params(virNetServerPtr server ATTRIBUTE_UNUSED,
+ virNetServerClientPtr client ATTRIBUTE_UNUSED,
+ virNetMessagePtr msg ATTRIBUTE_UNUSED,
+ virNetMessageErrorPtr rerr,
+ remote_domain_migrate_perform3_params_args *args,
+ remote_domain_migrate_perform3_params_ret *ret)
{
virTypedParameterPtr params = NULL;
int nparams = 0;
@@ -4928,13 +4924,12 @@ cleanup:
static int
-remoteDispatchDomainMigrateFinish3Params(
- virNetServerPtr server ATTRIBUTE_UNUSED,
- virNetServerClientPtr client ATTRIBUTE_UNUSED,
- virNetMessagePtr msg ATTRIBUTE_UNUSED,
- virNetMessageErrorPtr rerr,
- remote_domain_migrate_finish3_params_args *args,
- remote_domain_migrate_finish3_params_ret *ret)
+remoteDispatchDomainMigrateFinish3Params(virNetServerPtr server ATTRIBUTE_UNUSED,
+ virNetServerClientPtr client ATTRIBUTE_UNUSED,
+ virNetMessagePtr msg ATTRIBUTE_UNUSED,
+ virNetMessageErrorPtr rerr,
+ remote_domain_migrate_finish3_params_args *args,
+ remote_domain_migrate_finish3_params_ret *ret)
{
virTypedParameterPtr params = NULL;
int nparams = 0;
@@ -4990,12 +4985,11 @@ cleanup:
static int
-remoteDispatchDomainMigrateConfirm3Params(
- virNetServerPtr server ATTRIBUTE_UNUSED,
- virNetServerClientPtr client ATTRIBUTE_UNUSED,
- virNetMessagePtr msg ATTRIBUTE_UNUSED,
- virNetMessageErrorPtr rerr,
- remote_domain_migrate_confirm3_params_args *args)
+remoteDispatchDomainMigrateConfirm3Params(virNetServerPtr server ATTRIBUTE_UNUSED,
+ virNetServerClientPtr client ATTRIBUTE_UNUSED,
+ virNetMessagePtr msg ATTRIBUTE_UNUSED,
+ virNetMessageErrorPtr rerr,
+ remote_domain_migrate_confirm3_params_args *args)
{
virTypedParameterPtr params = NULL;
int nparams = 0;
@@ -5042,13 +5036,13 @@ cleanup:
}
-static int remoteDispatchDomainCreateXMLWithFiles(
- virNetServerPtr server ATTRIBUTE_UNUSED,
- virNetServerClientPtr client,
- virNetMessagePtr msg ATTRIBUTE_UNUSED,
- virNetMessageErrorPtr rerr,
- remote_domain_create_xml_with_files_args *args,
- remote_domain_create_xml_with_files_ret *ret)
+static int
+remoteDispatchDomainCreateXMLWithFiles(virNetServerPtr server ATTRIBUTE_UNUSED,
+ virNetServerClientPtr client,
+ virNetMessagePtr msg ATTRIBUTE_UNUSED,
+ virNetMessageErrorPtr rerr,
+ remote_domain_create_xml_with_files_args *args,
+ remote_domain_create_xml_with_files_ret *ret)
{
int rv = -1;
virDomainPtr dom = NULL;
@@ -5092,13 +5086,12 @@ cleanup:
}
-static int remoteDispatchDomainCreateWithFiles(
- virNetServerPtr server ATTRIBUTE_UNUSED,
- virNetServerClientPtr client,
- virNetMessagePtr msg ATTRIBUTE_UNUSED,
- virNetMessageErrorPtr rerr,
- remote_domain_create_with_files_args *args,
- remote_domain_create_with_files_ret *ret)
+static int remoteDispatchDomainCreateWithFiles(virNetServerPtr server ATTRIBUTE_UNUSED,
+ virNetServerClientPtr client,
+ virNetMessagePtr msg ATTRIBUTE_UNUSED,
+ virNetMessageErrorPtr rerr,
+ remote_domain_create_with_files_args *args,
+ remote_domain_create_with_files_ret *ret)
{
int rv = -1;
virDomainPtr dom = NULL;
--
1.7.11.7
11 years, 3 months
[libvirt] [PATCH] qemu: Make domain renaming work during migration
by Jiri Denemark
https://bugzilla.redhat.com/show_bug.cgi?id=999352
Since commit v1.0.5-56-g449e6b1 (Pull parsing of migration xml up into
QEMU driver APIs) any attempt to rename a domain during migration fails
with the following error message:
internal error Incoming cookie data had unexpected name DOM vs DOM2
This is because migration cookies always use the original domain name
and the mentioned commit failed to propagate the name back to
qemuMigrationPrepareAny.
---
src/qemu/qemu_driver.c | 36 ++++++++++++++++++++++++------------
src/qemu/qemu_migration.c | 31 +++++++++++++++++++------------
src/qemu/qemu_migration.h | 5 ++++-
3 files changed, 47 insertions(+), 25 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index ed29373..52ca906 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -9973,6 +9973,7 @@ qemuDomainMigratePrepareTunnel(virConnectPtr dconn,
{
virQEMUDriverPtr driver = dconn->privateData;
virDomainDefPtr def = NULL;
+ char *origname = NULL;
int ret = -1;
virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
@@ -9990,7 +9991,7 @@ qemuDomainMigratePrepareTunnel(virConnectPtr dconn,
goto cleanup;
}
- if (!(def = qemuMigrationPrepareDef(driver, dom_xml, dname)))
+ if (!(def = qemuMigrationPrepareDef(driver, dom_xml, dname, &origname)))
goto cleanup;
if (virDomainMigratePrepareTunnelEnsureACL(dconn, def) < 0)
@@ -9998,9 +9999,10 @@ qemuDomainMigratePrepareTunnel(virConnectPtr dconn,
ret = qemuMigrationPrepareTunnel(driver, dconn,
NULL, 0, NULL, NULL, /* No cookies in v2 */
- st, &def, flags);
+ st, &def, origname, flags);
cleanup:
+ VIR_FREE(origname);
virDomainDefFree(def);
return ret;
}
@@ -10022,6 +10024,7 @@ qemuDomainMigratePrepare2(virConnectPtr dconn,
{
virQEMUDriverPtr driver = dconn->privateData;
virDomainDefPtr def = NULL;
+ char *origname = NULL;
int ret = -1;
virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
@@ -10043,7 +10046,7 @@ qemuDomainMigratePrepare2(virConnectPtr dconn,
goto cleanup;
}
- if (!(def = qemuMigrationPrepareDef(driver, dom_xml, dname)))
+ if (!(def = qemuMigrationPrepareDef(driver, dom_xml, dname, &origname)))
goto cleanup;
if (virDomainMigratePrepare2EnsureACL(dconn, def) < 0)
@@ -10056,9 +10059,10 @@ qemuDomainMigratePrepare2(virConnectPtr dconn,
ret = qemuMigrationPrepareDirect(driver, dconn,
NULL, 0, NULL, NULL, /* No cookies */
uri_in, uri_out,
- &def, flags);
+ &def, origname, flags);
cleanup:
+ VIR_FREE(origname);
virDomainDefFree(def);
return ret;
}
@@ -10235,6 +10239,7 @@ qemuDomainMigratePrepare3(virConnectPtr dconn,
{
virQEMUDriverPtr driver = dconn->privateData;
virDomainDefPtr def = NULL;
+ char *origname = NULL;
int ret = -1;
virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
@@ -10249,7 +10254,7 @@ qemuDomainMigratePrepare3(virConnectPtr dconn,
goto cleanup;
}
- if (!(def = qemuMigrationPrepareDef(driver, dom_xml, dname)))
+ if (!(def = qemuMigrationPrepareDef(driver, dom_xml, dname, &origname)))
goto cleanup;
if (virDomainMigratePrepare3EnsureACL(dconn, def) < 0)
@@ -10259,9 +10264,10 @@ qemuDomainMigratePrepare3(virConnectPtr dconn,
cookiein, cookieinlen,
cookieout, cookieoutlen,
uri_in, uri_out,
- &def, flags);
+ &def, origname, flags);
cleanup:
+ VIR_FREE(origname);
virDomainDefFree(def);
return ret;
}
@@ -10282,6 +10288,7 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn,
const char *dom_xml = NULL;
const char *dname = NULL;
const char *uri_in = NULL;
+ char *origname = NULL;
int ret = -1;
virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
@@ -10309,7 +10316,7 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn,
goto cleanup;
}
- if (!(def = qemuMigrationPrepareDef(driver, dom_xml, dname)))
+ if (!(def = qemuMigrationPrepareDef(driver, dom_xml, dname, &origname)))
goto cleanup;
if (virDomainMigratePrepare3ParamsEnsureACL(dconn, def) < 0)
@@ -10319,9 +10326,10 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn,
cookiein, cookieinlen,
cookieout, cookieoutlen,
uri_in, uri_out,
- &def, flags);
+ &def, origname, flags);
cleanup:
+ VIR_FREE(origname);
virDomainDefFree(def);
return ret;
}
@@ -10341,6 +10349,7 @@ qemuDomainMigratePrepareTunnel3(virConnectPtr dconn,
{
virQEMUDriverPtr driver = dconn->privateData;
virDomainDefPtr def = NULL;
+ char *origname = NULL;
int ret = -1;
virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
@@ -10351,7 +10360,7 @@ qemuDomainMigratePrepareTunnel3(virConnectPtr dconn,
goto cleanup;
}
- if (!(def = qemuMigrationPrepareDef(driver, dom_xml, dname)))
+ if (!(def = qemuMigrationPrepareDef(driver, dom_xml, dname, &origname)))
goto cleanup;
if (virDomainMigratePrepareTunnel3EnsureACL(dconn, def) < 0)
@@ -10360,9 +10369,10 @@ qemuDomainMigratePrepareTunnel3(virConnectPtr dconn,
ret = qemuMigrationPrepareTunnel(driver, dconn,
cookiein, cookieinlen,
cookieout, cookieoutlen,
- st, &def, flags);
+ st, &def, origname, flags);
cleanup:
+ VIR_FREE(origname);
virDomainDefFree(def);
return ret;
}
@@ -10382,6 +10392,7 @@ qemuDomainMigratePrepareTunnel3Params(virConnectPtr dconn,
virDomainDefPtr def = NULL;
const char *dom_xml = NULL;
const char *dname = NULL;
+ char *origname = NULL;
int ret = -1;
virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
@@ -10402,7 +10413,7 @@ qemuDomainMigratePrepareTunnel3Params(virConnectPtr dconn,
goto cleanup;
}
- if (!(def = qemuMigrationPrepareDef(driver, dom_xml, dname)))
+ if (!(def = qemuMigrationPrepareDef(driver, dom_xml, dname, &origname)))
goto cleanup;
if (virDomainMigratePrepareTunnel3ParamsEnsureACL(dconn, def) < 0)
@@ -10411,9 +10422,10 @@ qemuDomainMigratePrepareTunnel3Params(virConnectPtr dconn,
ret = qemuMigrationPrepareTunnel(driver, dconn,
cookiein, cookieinlen,
cookieout, cookieoutlen,
- st, &def, flags);
+ st, &def, origname, flags);
cleanup:
+ VIR_FREE(origname);
virDomainDefFree(def);
return ret;
}
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index b905459..3177756 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2160,6 +2160,7 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
char **cookieout,
int *cookieoutlen,
virDomainDefPtr *def,
+ const char *origname,
virStreamPtr st,
unsigned int port,
unsigned long flags)
@@ -2172,7 +2173,6 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
unsigned long long now;
qemuMigrationCookiePtr mig = NULL;
bool tunnel = !!st;
- char *origname = NULL;
char *xmlout = NULL;
unsigned int cookieFlags;
virCapsPtr caps = NULL;
@@ -2297,8 +2297,8 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
*def = NULL;
priv = vm->privateData;
- priv->origname = origname;
- origname = NULL;
+ if (VIR_STRDUP(priv->origname, origname) < 0)
+ goto cleanup;
if (!(mig = qemuMigrationEatCookie(driver, vm, cookiein, cookieinlen,
QEMU_MIGRATION_COOKIE_LOCKSTATE |
@@ -2412,7 +2412,6 @@ done:
cleanup:
VIR_FREE(migrateFrom);
- VIR_FREE(origname);
VIR_FREE(xmlout);
VIR_FORCE_CLOSE(dataFD[0]);
VIR_FORCE_CLOSE(dataFD[1]);
@@ -2457,15 +2456,16 @@ qemuMigrationPrepareTunnel(virQEMUDriverPtr driver,
int *cookieoutlen,
virStreamPtr st,
virDomainDefPtr *def,
+ const char *origname,
unsigned long flags)
{
int ret;
VIR_DEBUG("driver=%p, dconn=%p, cookiein=%s, cookieinlen=%d, "
"cookieout=%p, cookieoutlen=%p, st=%p, def=%p, "
- "flags=%lx",
+ "origname=%s, flags=%lx",
driver, dconn, NULLSTR(cookiein), cookieinlen,
- cookieout, cookieoutlen, st, *def, flags);
+ cookieout, cookieoutlen, st, *def, origname, flags);
if (st == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -2474,7 +2474,7 @@ qemuMigrationPrepareTunnel(virQEMUDriverPtr driver,
}
ret = qemuMigrationPrepareAny(driver, dconn, cookiein, cookieinlen,
- cookieout, cookieoutlen, def,
+ cookieout, cookieoutlen, def, origname,
st, 0, flags);
return ret;
}
@@ -2490,6 +2490,7 @@ qemuMigrationPrepareDirect(virQEMUDriverPtr driver,
const char *uri_in,
char **uri_out,
virDomainDefPtr *def,
+ const char *origname,
unsigned long flags)
{
static int port = 0;
@@ -2502,10 +2503,10 @@ qemuMigrationPrepareDirect(virQEMUDriverPtr driver,
VIR_DEBUG("driver=%p, dconn=%p, cookiein=%s, cookieinlen=%d, "
"cookieout=%p, cookieoutlen=%p, uri_in=%s, uri_out=%p, "
- "def=%p, flags=%lx",
+ "def=%p, origname=%s, flags=%lx",
driver, dconn, NULLSTR(cookiein), cookieinlen,
cookieout, cookieoutlen, NULLSTR(uri_in), uri_out,
- *def, flags);
+ *def, origname, flags);
*uri_out = NULL;
@@ -2594,7 +2595,7 @@ qemuMigrationPrepareDirect(virQEMUDriverPtr driver,
VIR_DEBUG("Generated uri_out=%s", *uri_out);
ret = qemuMigrationPrepareAny(driver, dconn, cookiein, cookieinlen,
- cookieout, cookieoutlen, def,
+ cookieout, cookieoutlen, def, origname,
NULL, this_port, flags);
cleanup:
virURIFree(uri);
@@ -2608,10 +2609,12 @@ cleanup:
virDomainDefPtr
qemuMigrationPrepareDef(virQEMUDriverPtr driver,
const char *dom_xml,
- const char *dname)
+ const char *dname,
+ char **origname)
{
virCapsPtr caps = NULL;
virDomainDefPtr def;
+ char *name = NULL;
if (!dom_xml) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -2628,7 +2631,7 @@ qemuMigrationPrepareDef(virQEMUDriverPtr driver,
goto cleanup;
if (dname) {
- VIR_FREE(def->name);
+ name = def->name;
if (VIR_STRDUP(def->name, dname) < 0) {
virDomainDefFree(def);
def = NULL;
@@ -2637,6 +2640,10 @@ qemuMigrationPrepareDef(virQEMUDriverPtr driver,
cleanup:
virObjectUnref(caps);
+ if (def && origname)
+ *origname = name;
+ else
+ VIR_FREE(name);
return def;
}
diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h
index 0f6c5f7..4af5aed 100644
--- a/src/qemu/qemu_migration.h
+++ b/src/qemu/qemu_migration.h
@@ -100,7 +100,8 @@ char *qemuMigrationBegin(virConnectPtr conn,
virDomainDefPtr qemuMigrationPrepareDef(virQEMUDriverPtr driver,
const char *dom_xml,
- const char *dname);
+ const char *dname,
+ char **origname);
int qemuMigrationPrepareTunnel(virQEMUDriverPtr driver,
virConnectPtr dconn,
@@ -110,6 +111,7 @@ int qemuMigrationPrepareTunnel(virQEMUDriverPtr driver,
int *cookieoutlen,
virStreamPtr st,
virDomainDefPtr *def,
+ const char *origname,
unsigned long flags);
int qemuMigrationPrepareDirect(virQEMUDriverPtr driver,
@@ -121,6 +123,7 @@ int qemuMigrationPrepareDirect(virQEMUDriverPtr driver,
const char *uri_in,
char **uri_out,
virDomainDefPtr *def,
+ const char *origname,
unsigned long flags);
int qemuMigrationPerform(virQEMUDriverPtr driver,
--
1.8.3.2
11 years, 3 months
[libvirt] [PATCH] AppArmorSetSecurityImageLabel: Avoid use of uninitialized variable
by Michal Privoznik
The @profile_name variable can be used uninitialized.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Pushing under trivial and build breaker rules.
src/security/security_apparmor.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index eb80d23..adc9918 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -683,7 +683,7 @@ AppArmorSetSecurityImageLabel(virSecurityManagerPtr mgr,
virDomainDefPtr def, virDomainDiskDefPtr disk)
{
int rc = -1;
- char *profile_name;
+ char *profile_name = NULL;
const virSecurityLabelDefPtr secdef =
virDomainDefGetSecurityLabelDef(def, SECURITY_APPARMOR_NAME);
--
1.8.1.5
11 years, 3 months
[libvirt] [PATCH] libxl: Use standard format for source file copyright notice
by Jim Fehlig
Change source file copyright notice to prevailing libvirt style.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
Pushing under the trivial rule.
src/libxl/libxl_conf.c | 9 +++++----
src/libxl/libxl_conf.h | 9 +++++----
src/libxl/libxl_driver.c | 11 ++++++-----
src/libxl/libxl_driver.h | 7 ++++---
4 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 34f6bc1..fcb278b 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -1,6 +1,8 @@
-/*---------------------------------------------------------------------------*/
-/* Copyright (C) 2012 Red Hat, Inc.
- * Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
+/*
+ * libxl_conf.c: libxl configuration management
+ *
+ * Copyright (C) 2012 Red Hat, Inc.
+ * Copyright (c) 2011-2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
* Copyright (C) 2011 Univention GmbH.
*
* This library is free software; you can redistribute it and/or
@@ -21,7 +23,6 @@
* Jim Fehlig <jfehlig(a)novell.com>
* Markus Groß <gross(a)univention.de>
*/
-/*---------------------------------------------------------------------------*/
#include <config.h>
diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h
index 174a759..8ba0ee4 100644
--- a/src/libxl/libxl_conf.h
+++ b/src/libxl/libxl_conf.h
@@ -1,6 +1,8 @@
-/*---------------------------------------------------------------------------*/
-/* Copyright (C) 2011-2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
- * Copyright (C) 2011 Univention GmbH.
+/*
+ * libxl_conf.h: libxl configuration management
+ *
+ * Copyright (C) 2011-2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
+ * Copyright (C) 2011 Univention GmbH.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -20,7 +22,6 @@
* Jim Fehlig <jfehlig(a)novell.com>
* Markus Groß <gross(a)univention.de>
*/
-/*---------------------------------------------------------------------------*/
#ifndef LIBXL_CONF_H
# define LIBXL_CONF_H
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 2200e9e..69b992b 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -1,7 +1,9 @@
-/*---------------------------------------------------------------------------*/
-/* Copyright (C) 2006-2013 Red Hat, Inc.
- * Copyright (C) 2011-2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
- * Copyright (C) 2011 Univention GmbH.
+/*
+ * libxl_driver.c: core driver methods for managing libxenlight domains
+ *
+ * Copyright (C) 2006-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
+ * Copyright (C) 2011 Univention GmbH.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -22,7 +24,6 @@
* Markus Groß <gross(a)univention.de>
* Daniel P. Berrange <berrange(a)redhat.com>
*/
-/*---------------------------------------------------------------------------*/
#include <config.h>
diff --git a/src/libxl/libxl_driver.h b/src/libxl/libxl_driver.h
index fba6c5a..a33d60c 100644
--- a/src/libxl/libxl_driver.h
+++ b/src/libxl/libxl_driver.h
@@ -1,5 +1,7 @@
-/*---------------------------------------------------------------------------*/
-/* Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
+/*
+ * libxl_driver.h: core driver methods for managing libxenlight domains
+ *
+ * Copyright (c) 2011-2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -18,7 +20,6 @@
* Authors:
* Jim Fehlig <jfehlig(a)novell.com>
*/
-/*---------------------------------------------------------------------------*/
#ifndef LIBXL_DRIVER_H
# define LIBXL_DRIVER_H
--
1.8.1.4
11 years, 3 months
[libvirt] [libvirt-users] Is virsh blockcommit supported? Thanks a lot
by Guozhonghua
Hi,
I have another question, when I do the blockcommit command and get the result " Top image as the active layer is currently unsupported ", is it being developed?
root@cvk-31:/vms/images# virsh blockcommit Vmtest /vms/images/Vmtest1;echo $?
error: internal error unable to execute QEMU command 'block-commit': Top image as the active layer is currently unsupported
1
But as I specified the commit file which is not the current image file, it will be work, such as below:
root@cvk-31:/vms/images# qemu-img info --backing-chain /vms/images/Vmtest1
image: /vms/images/Vmtest1
file format: qcow2
virtual size: 9.8G (10485760000 bytes)
disk size: 18M
cluster_size: 65536
backing file: /vms/images/Vmtest1_base_1
backing file format: qcow2
image: /vms/images/Vmtest1_base_1
file format: qcow2
virtual size: 9.8G (10485760000 bytes)
disk size: 196K
cluster_size: 65536
backing file: /vms/images/Vmtest1_base
backing file format: qcow2
image: /vms/images/Vmtest1_base
file format: qcow2
virtual size: 9.8G (10485760000 bytes)
disk size: 3.4G
cluster_size: 2097152
root@cvk-31:/vms/images# virsh blockcommit Vmtest /vms/images/Vmtest1 --base /vms/images/Vmtest1_base --top /vms/images/Vmtest1_base_1 --wait --verbose;echo $?
Block Commit: [100 %]
Commit complete
0
-------------------------------------------------------------------------------------------------------------------------------------
本邮件及其附件含有杭州华三通信技术有限公司的保密信息,仅限于发送给上面地址中列出
的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、
或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本
邮件!
This e-mail and its attachments contain confidential information from H3C, which is
intended only for the person or entity whose address is listed above. Any use of the
information contained herein in any way (including, but not limited to, total or partial
disclosure, reproduction, or dissemination) by persons other than the intended
recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender
by phone or email immediately and delete it!
11 years, 3 months
[libvirt] [PATCH] build: fix typo that broke 'make dist'
by Eric Blake
Otherwise, 'make dist' fails:
make[3]: Entering directory `/home/eblake/libvirt-tmp/build3/examples/python'
make[3]: *** No rule to make target `topoology.py', needed by `distdir'. Stop.
make[3]: Leaving directory `/home/eblake/libvirt-tmp/build3/examples/python'
* examples/python/Makefile.am (EXTRA_DIST): Spell topology right.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Pushing under the build-breaker rule.
examples/python/Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/examples/python/Makefile.am b/examples/python/Makefile.am
index d5d867c..7823c20 100644
--- a/examples/python/Makefile.am
+++ b/examples/python/Makefile.am
@@ -17,5 +17,5 @@
EXTRA_DIST= \
README \
consolecallback.py \
- topoology.py \
+ topology.py \
dominfo.py domrestore.py domsave.py domstart.py esxlist.py
--
1.8.3.1
11 years, 3 months
[libvirt] [PATCH 0/2] Handle a couple of new Coverity warnings
by John Ferlan
Coverity 6.6.1 was recently made available - installed it and a couple more
RESOURCE_LEAK's were found in error paths.
John Ferlan (2):
esx_vi: Resolve Coverity RESOURCE_LEAK in error path
esx_driver: Resolve Coverity RESOURCE_LEAK on error paths
src/esx/esx_driver.c | 10 +++++-----
src/esx/esx_vi.c | 14 ++++++++++++++
2 files changed, 19 insertions(+), 5 deletions(-)
--
1.8.3.1
11 years, 3 months
[libvirt] [PATCH] test_virtlockd.aug.in: Use the correct file
by Michal Privoznik
The test should refer to Virtlockd.lns, which is the name of
the module + lens in virtlockd.aug.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/locking/test_virtlockd.aug.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/locking/test_virtlockd.aug.in b/src/locking/test_virtlockd.aug.in
index dcd47c3..799818e 100644
--- a/src/locking/test_virtlockd.aug.in
+++ b/src/locking/test_virtlockd.aug.in
@@ -5,7 +5,7 @@ log_outputs=\"3:syslog:libvirtd\"
log_buffer_size = 64
"
- test Libvirtd.lns get conf =
+ test Virtlockd.lns get conf =
{ "log_level" = "3" }
{ "log_filters" = "3:remote 4:event" }
{ "log_outputs" = "3:syslog:libvirtd" }
--
1.8.1.5
11 years, 3 months
[libvirt] [PATCH] Stop free'ing 'const char *' strings
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
The VIR_FREE() macro will cast away any const-ness. This masked a
number of places where we passed a 'const char *' string to
VIR_FREE. Fortunately in all of these cases, the variable was not
in fact const data, but a heap allocated string. Fix all the
variable declarations to reflect this.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/conf/domain_conf.c | 30 +++++++++++++++---------------
src/conf/netdev_vlan_conf.c | 4 ++--
src/conf/nwfilter_conf.c | 3 ++-
src/node_device/node_device_udev.c | 2 +-
src/nwfilter/nwfilter_gentech_driver.c | 2 +-
src/qemu/qemu_command.c | 33 +++++++++++++++++++--------------
src/qemu/qemu_domain.c | 2 +-
src/qemu/qemu_driver.c | 4 ++--
src/rpc/virnetsshsession.c | 34 +++++++++++++++++++++-------------
src/storage/storage_backend.c | 2 +-
src/storage/storage_driver.c | 2 +-
src/util/vircommand.c | 9 ++++-----
src/util/virlog.c | 4 ++--
tools/virsh-domain.c | 19 ++++++++++---------
14 files changed, 82 insertions(+), 68 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index f8fbf79..678f8ca 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -6745,9 +6745,9 @@ virDomainChrDefParseTargetXML(virDomainChrDefPtr def,
{
int ret = -1;
unsigned int port;
- const char *targetType = virXMLPropString(cur, "type");
- const char *addrStr = NULL;
- const char *portStr = NULL;
+ char *targetType = virXMLPropString(cur, "type");
+ char *addrStr = NULL;
+ char *portStr = NULL;
if ((def->targetType =
virDomainChrTargetTypeFromString(def, def->deviceType,
@@ -8161,7 +8161,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
while (cur != NULL) {
if (cur->type == XML_ELEMENT_NODE) {
if (xmlStrEqual(cur->name, BAD_CAST "channel")) {
- const char *name, *mode;
+ char *name, *mode;
int nameval, modeval;
name = virXMLPropString(cur, "name");
mode = virXMLPropString(cur, "mode");
@@ -8195,7 +8195,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
def->data.spice.channels[nameval] = modeval;
} else if (xmlStrEqual(cur->name, BAD_CAST "image")) {
- const char *compression = virXMLPropString(cur, "compression");
+ char *compression = virXMLPropString(cur, "compression");
int compressionVal;
if (!compression) {
@@ -8216,7 +8216,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
def->data.spice.image = compressionVal;
} else if (xmlStrEqual(cur->name, BAD_CAST "jpeg")) {
- const char *compression = virXMLPropString(cur, "compression");
+ char *compression = virXMLPropString(cur, "compression");
int compressionVal;
if (!compression) {
@@ -8237,7 +8237,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
def->data.spice.jpeg = compressionVal;
} else if (xmlStrEqual(cur->name, BAD_CAST "zlib")) {
- const char *compression = virXMLPropString(cur, "compression");
+ char *compression = virXMLPropString(cur, "compression");
int compressionVal;
if (!compression) {
@@ -8258,7 +8258,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
def->data.spice.zlib = compressionVal;
} else if (xmlStrEqual(cur->name, BAD_CAST "playback")) {
- const char *compression = virXMLPropString(cur, "compression");
+ char *compression = virXMLPropString(cur, "compression");
int compressionVal;
if (!compression) {
@@ -8279,7 +8279,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
def->data.spice.playback = compressionVal;
} else if (xmlStrEqual(cur->name, BAD_CAST "streaming")) {
- const char *mode = virXMLPropString(cur, "mode");
+ char *mode = virXMLPropString(cur, "mode");
int modeVal;
if (!mode) {
@@ -8299,7 +8299,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
def->data.spice.streaming = modeVal;
} else if (xmlStrEqual(cur->name, BAD_CAST "clipboard")) {
- const char *copypaste = virXMLPropString(cur, "copypaste");
+ char *copypaste = virXMLPropString(cur, "copypaste");
int copypasteVal;
if (!copypaste) {
@@ -8319,7 +8319,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
def->data.spice.copypaste = copypasteVal;
} else if (xmlStrEqual(cur->name, BAD_CAST "mouse")) {
- const char *mode = virXMLPropString(cur, "mode");
+ char *mode = virXMLPropString(cur, "mode");
int modeVal;
if (!mode) {
@@ -8511,9 +8511,9 @@ virDomainRNGDefParseXML(const xmlNodePtr node,
xmlXPathContextPtr ctxt,
unsigned int flags)
{
- const char *model = NULL;
- const char *backend = NULL;
- const char *type = NULL;
+ char *model = NULL;
+ char *backend = NULL;
+ char *type = NULL;
virDomainRNGDefPtr def;
xmlNodePtr save = ctxt->node;
xmlNodePtr *backends = NULL;
@@ -15197,7 +15197,7 @@ virDomainChrDefFormat(virBufferPtr buf,
return -1;
}
- const char *addr = virSocketAddrFormat(def->target.addr);
+ char *addr = virSocketAddrFormat(def->target.addr);
if (addr == NULL)
return -1;
diff --git a/src/conf/netdev_vlan_conf.c b/src/conf/netdev_vlan_conf.c
index 60d9eb8..24e1000 100644
--- a/src/conf/netdev_vlan_conf.c
+++ b/src/conf/netdev_vlan_conf.c
@@ -36,8 +36,8 @@ virNetDevVlanParse(xmlNodePtr node, xmlXPathContextPtr ctxt, virNetDevVlanPtr de
{
int ret = -1;
xmlNodePtr save = ctxt->node;
- const char *trunk = NULL;
- const char *nativeMode = NULL;
+ char *trunk = NULL;
+ char *nativeMode = NULL;
xmlNodePtr *tagNodes = NULL;
int nTags;
size_t i;
diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
index a3901d3..00e74eb 100644
--- a/src/conf/nwfilter_conf.c
+++ b/src/conf/nwfilter_conf.c
@@ -2432,7 +2432,8 @@ static const char *
virNWFilterIsAllowedChain(const char *chainname)
{
enum virNWFilterChainSuffixType i;
- const char *name, *msg;
+ const char *name;
+ char *msg;
virBuffer buf = VIR_BUFFER_INITIALIZER;
bool printed = false;
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 67fcc58..785c2fa 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -367,7 +367,7 @@ udevLogFunction(struct udev *udev ATTRIBUTE_UNUSED,
va_list args)
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
- const char *format = NULL;
+ char *format = NULL;
virBufferAdd(&buf, fmt, -1);
virBufferTrim(&buf, "\n", -1);
diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter_gentech_driver.c
index ee9195b..382d73f 100644
--- a/src/nwfilter/nwfilter_gentech_driver.c
+++ b/src/nwfilter/nwfilter_gentech_driver.c
@@ -499,7 +499,7 @@ virNWFilterDetermineMissingVarsRec(virNWFilterDefPtr filter,
for (j = 0; j < rule->nVarAccess; j++) {
if (!virNWFilterVarAccessIsAvailable(rule->varAccess[j],
vars)) {
- const char *varAccess;
+ char *varAccess;
virBuffer buf = VIR_BUFFER_INITIALIZER;
virNWFilterVarAccessPrint(rule->varAccess[j], &buf);
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index f8fccea..754d95a 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6050,7 +6050,8 @@ static char *qemuBuildTPMBackendStr(const virDomainDefPtr def,
const virDomainTPMDefPtr tpm = def->tpm;
virBuffer buf = VIR_BUFFER_INITIALIZER;
const char *type = virDomainTPMBackendTypeToString(tpm->type);
- const char *cancel_path, *tpmdev;
+ char *cancel_path;
+ const char *tpmdev;
virBufferAsprintf(&buf, "%s,id=tpm-%s", type, tpm->info.alias);
@@ -7667,7 +7668,7 @@ qemuBuildCommandLine(virConnectPtr conn,
}
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_RTC)) {
- const char *rtcopt;
+ char *rtcopt;
virCommandAddArg(cmd, "-rtc");
if (!(rtcopt = qemuBuildClockArgStr(&def->clock)))
goto error;
@@ -9529,8 +9530,8 @@ qemuBuildChrDeviceStr(char **deviceStr,
* on space
*/
static int qemuStringToArgvEnv(const char *args,
- const char ***retenv,
- const char ***retargv)
+ char ***retenv,
+ char ***retargv)
{
char **arglist = NULL;
int argcount = 0;
@@ -9539,8 +9540,8 @@ static int qemuStringToArgvEnv(const char *args,
size_t i;
const char *curr = args;
const char *start;
- const char **progenv = NULL;
- const char **progargv = NULL;
+ char **progenv = NULL;
+ char **progargv = NULL;
/* Iterate over string, splitting on sequences of ' ' */
while (curr && *curr != '\0') {
@@ -11738,15 +11739,17 @@ virDomainDefPtr qemuParseCommandLineString(virCapsPtr qemuCaps,
virDomainChrSourceDefPtr *monConfig,
bool *monJSON)
{
- const char **progenv = NULL;
- const char **progargv = NULL;
+ char **progenv = NULL;
+ char **progargv = NULL;
virDomainDefPtr def = NULL;
size_t i;
if (qemuStringToArgvEnv(args, &progenv, &progargv) < 0)
goto cleanup;
- def = qemuParseCommandLine(qemuCaps, xmlopt, progenv, progargv,
+ def = qemuParseCommandLine(qemuCaps, xmlopt,
+ (const char **)progenv,
+ (const char **)progargv,
pidfile, monConfig, monJSON);
cleanup:
@@ -11764,7 +11767,7 @@ cleanup:
static int qemuParseProcFileStrings(int pid_value,
const char *name,
- const char ***list)
+ char ***list)
{
char *path = NULL;
int ret = -1;
@@ -11800,7 +11803,7 @@ static int qemuParseProcFileStrings(int pid_value,
str[nstr-1] = NULL;
ret = nstr-1;
- *list = (const char **) str;
+ *list = str;
cleanup:
if (ret < 0) {
@@ -11821,8 +11824,8 @@ virDomainDefPtr qemuParseCommandLinePid(virCapsPtr qemuCaps,
bool *monJSON)
{
virDomainDefPtr def = NULL;
- const char **progargv = NULL;
- const char **progenv = NULL;
+ char **progargv = NULL;
+ char **progenv = NULL;
char *exepath = NULL;
char *emulator;
size_t i;
@@ -11834,7 +11837,9 @@ virDomainDefPtr qemuParseCommandLinePid(virCapsPtr qemuCaps,
qemuParseProcFileStrings(pid, "environ", &progenv) < 0)
goto cleanup;
- if (!(def = qemuParseCommandLine(qemuCaps, xmlopt, progenv, progargv,
+ if (!(def = qemuParseCommandLine(qemuCaps, xmlopt,
+ (const char **)progenv,
+ (const char **)progargv,
pidfile, monConfig, monJSON)))
goto cleanup;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 7f4d17d..b71fa4e 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1355,7 +1355,7 @@ qemuDomainDefCopy(virQEMUDriverPtr driver,
virBuffer buf = VIR_BUFFER_INITIALIZER;
virDomainDefPtr ret = NULL;
virCapsPtr caps = NULL;
- const char *xml = NULL;
+ char *xml = NULL;
if (qemuDomainDefFormatBuf(driver, src, flags, &buf) < 0)
goto cleanup;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index ed29373..fa70e74 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -14646,7 +14646,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
virDomainDefPtr persistentDef = NULL;
virDomainBlockIoTuneInfo info;
virDomainBlockIoTuneInfo *oldinfo;
- const char *device = NULL;
+ char *device = NULL;
int ret = -1;
size_t i;
int idx = -1;
@@ -14824,7 +14824,7 @@ qemuDomainGetBlockIoTune(virDomainPtr dom,
qemuDomainObjPrivatePtr priv;
virDomainDefPtr persistentDef = NULL;
virDomainBlockIoTuneInfo reply;
- const char *device = NULL;
+ char *device = NULL;
int ret = -1;
size_t i;
virCapsPtr caps = NULL;
diff --git a/src/rpc/virnetsshsession.c b/src/rpc/virnetsshsession.c
index 816c54e..f544d69 100644
--- a/src/rpc/virnetsshsession.c
+++ b/src/rpc/virnetsshsession.c
@@ -268,8 +268,9 @@ virNetSSHKbIntCb(const char *name ATTRIBUTE_UNUSED,
cleanup:
if (askcred) {
for (i = 0; i < num_prompts; i++) {
+ char *prompt = (char *)askcred[i].prompt;
VIR_FREE(askcred[i].result);
- VIR_FREE(askcred[i].prompt);
+ VIR_FREE(prompt);
}
}
@@ -291,6 +292,8 @@ virNetSSHCheckHostKey(virNetSSHSessionPtr sess)
int ret;
const char *key;
const char *keyhash;
+ char *keyhashstr;
+ char *tmp;
int keyType;
size_t keyLength;
char *errmsg;
@@ -364,7 +367,7 @@ virNetSSHCheckHostKey(virNetSSHSessionPtr sess)
* Sadly, there's no constant to describe the hash length, so
* we have to use a *MAGIC* constant. */
for (i = 0; i < 16; i++)
- virBufferAsprintf(&buff, "%02hhX:", keyhash[i]);
+ virBufferAsprintf(&buff, "%02hhX:", keyhash[i]);
virBufferTrim(&buff, ":", 1);
if (virBufferError(&buff) != 0) {
@@ -372,16 +375,16 @@ virNetSSHCheckHostKey(virNetSSHSessionPtr sess)
return -1;
}
- keyhash = virBufferContentAndReset(&buff);
+ keyhashstr = virBufferContentAndReset(&buff);
askKey.type = VIR_CRED_ECHOPROMPT;
if (virAsprintf((char **)&askKey.prompt,
_("Accept SSH host key with hash '%s' for "
"host '%s:%d' (%s/%s)?"),
- keyhash,
+ keyhashstr,
sess->hostname, sess->port,
"y", "n") < 0) {
- VIR_FREE(keyhash);
+ VIR_FREE(keyhashstr);
return -1;
}
@@ -389,23 +392,25 @@ virNetSSHCheckHostKey(virNetSSHSessionPtr sess)
virReportError(VIR_ERR_SSH, "%s",
_("failed to retrieve decision to accept "
"host key"));
- VIR_FREE(askKey.prompt);
- VIR_FREE(keyhash);
+ tmp = (char*)askKey.prompt;
+ VIR_FREE(tmp);
+ VIR_FREE(keyhashstr);
return -1;
}
- VIR_FREE(askKey.prompt);
+ tmp = (char*)askKey.prompt;
+ VIR_FREE(tmp);
if (!askKey.result ||
STRCASENEQ(askKey.result, "y")) {
virReportError(VIR_ERR_SSH,
_("SSH host key for '%s' (%s) was not accepted"),
- sess->hostname, keyhash);
- VIR_FREE(keyhash);
+ sess->hostname, keyhashstr);
+ VIR_FREE(keyhashstr);
VIR_FREE(askKey.result);
return -1;
}
- VIR_FREE(keyhash);
+ VIR_FREE(keyhashstr);
VIR_FREE(askKey.result);
}
@@ -590,6 +595,7 @@ virNetSSHAuthenticatePrivkey(virNetSSHSessionPtr sess,
size_t i;
char *errmsg;
int ret;
+ char *tmp;
/* try open the key with no password */
if ((ret = libssh2_userauth_publickey_fromfile(sess->session,
@@ -644,11 +650,13 @@ virNetSSHAuthenticatePrivkey(virNetSSHSessionPtr sess,
virReportError(VIR_ERR_SSH, "%s",
_("failed to retrieve private key passphrase: "
"callback has failed"));
- VIR_FREE(retr_passphrase.prompt);
+ tmp = (char *)retr_passphrase.prompt;
+ VIR_FREE(tmp);
return -1;
}
- VIR_FREE(retr_passphrase.prompt);
+ tmp = (char *)retr_passphrase.prompt;
+ VIR_FREE(tmp);
ret = libssh2_userauth_publickey_fromfile(sess->session,
priv->username,
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index 4ebe11b..ed893f0 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -931,7 +931,7 @@ virStorageBackendCreateQemuImg(virConnectPtr conn,
unsigned int flags)
{
int ret = -1;
- const char *create_tool;
+ char *create_tool;
int imgformat;
virCommandPtr cmd;
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 323be9e..6c39284 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -1450,7 +1450,7 @@ storageVolLookupByPath(virConnectPtr conn,
virStoragePoolObjLock(driver->pools.objs[i]);
if (virStoragePoolObjIsActive(driver->pools.objs[i])) {
virStorageVolDefPtr vol;
- const char *stable_path;
+ char *stable_path;
stable_path = virStorageBackendStablePath(driver->pools.objs[i],
cleanpath,
diff --git a/src/util/vircommand.c b/src/util/vircommand.c
index 00ff69a..95331a6 100644
--- a/src/util/vircommand.c
+++ b/src/util/vircommand.c
@@ -405,6 +405,7 @@ virExec(virCommandPtr cmd)
int childout = -1;
int childerr = -1;
int tmpfd;
+ char *binarystr = NULL;
const char *binary = NULL;
int forkRet, ret;
struct sigaction waxon, waxoff;
@@ -412,7 +413,7 @@ virExec(virCommandPtr cmd)
int ngroups;
if (cmd->args[0][0] != '/') {
- if (!(binary = virFindFileInPath(cmd->args[0]))) {
+ if (!(binary = binarystr = virFindFileInPath(cmd->args[0]))) {
virReportSystemError(ENOENT,
_("Cannot find '%s' in path"),
cmd->args[0]);
@@ -506,8 +507,7 @@ virExec(virCommandPtr cmd)
cmd->pid = pid;
- if (binary != cmd->args[0])
- VIR_FREE(binary);
+ VIR_FREE(binarystr);
VIR_FREE(groups);
return 0;
@@ -713,8 +713,7 @@ virExec(virCommandPtr cmd)
should never jump here on error */
VIR_FREE(groups);
- if (binary != cmd->args[0])
- VIR_FREE(binary);
+ VIR_FREE(binarystr);
/* NB we don't virReportError() on any failures here
because the code which jumped here already raised
diff --git a/src/util/virlog.c b/src/util/virlog.c
index 047a131..7ee5117 100644
--- a/src/util/virlog.c
+++ b/src/util/virlog.c
@@ -94,7 +94,7 @@ static regex_t *virLogRegex = NULL;
* based on a matching pattern (currently a substring)
*/
struct _virLogFilter {
- const char *match;
+ char *match;
virLogPriority priority;
unsigned int flags;
};
@@ -115,7 +115,7 @@ struct _virLogOutput {
virLogCloseFunc c;
virLogPriority priority;
virLogDestination dest;
- const char *name;
+ char *name;
};
typedef struct _virLogOutput virLogOutput;
typedef virLogOutput *virLogOutputPtr;
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 568d61d..ad15912 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -2346,8 +2346,8 @@ cmdDomIfSetLink(vshControl *ctl, const vshCmd *cmd)
virDomainPtr dom;
const char *iface;
const char *state;
- const char *value;
- const char *desc;
+ char *value;
+ char *desc;
virMacAddr macaddr;
const char *element;
const char *attr;
@@ -6167,7 +6167,7 @@ cmdCPUBaseline(vshControl *ctl, const vshCmd *cmd)
bool ret = false;
char *buffer;
char *result = NULL;
- const char **list = NULL;
+ char **list = NULL;
unsigned int flags = 0;
int count = 0;
@@ -6224,7 +6224,8 @@ cmdCPUBaseline(vshControl *ctl, const vshCmd *cmd)
list[i] = vshStrdup(ctl, (const char *)xmlBufferContent(xml_buf));
}
- result = virConnectBaselineCPU(ctl->conn, list, count, flags);
+ result = virConnectBaselineCPU(ctl->conn,
+ (const char **)list, count, flags);
if (result) {
vshPrint(ctl, "%s", result);
@@ -6379,7 +6380,7 @@ cmdCPUStats(vshControl *ctl, const vshCmd *cmd)
params[pos].value.ul / 1000000000,
params[pos].value.ul % 1000000000);
} else {
- const char *s = vshGetTypedParamValue(ctl, ¶ms[pos]);
+ char *s = vshGetTypedParamValue(ctl, ¶ms[pos]);
vshPrint(ctl, _("%s\n"), s);
VIR_FREE(s);
}
@@ -9855,8 +9856,8 @@ vshPrepareDiskXML(xmlNodePtr disk_node,
{
xmlNodePtr cur = NULL;
xmlBufferPtr xml_buf = NULL;
- const char *disk_type = NULL;
- const char *device_type = NULL;
+ char *disk_type = NULL;
+ char *device_type = NULL;
xmlNodePtr new_node = NULL;
char *ret = NULL;
@@ -10192,9 +10193,9 @@ cmdChangeMedia(vshControl *ctl, const vshCmd *cmd)
virDomainPtr dom = NULL;
const char *source = NULL;
const char *path = NULL;
- const char *doc = NULL;
+ char *doc = NULL;
xmlNodePtr disk_node = NULL;
- const char *disk_xml = NULL;
+ char *disk_xml = NULL;
bool ret = false;
int prepare_type = 0;
const char *action = NULL;
--
1.8.3.1
11 years, 3 months