diff --git a/ChangeLog b/ChangeLog index c2bc0ec9e954728922eadd2c6a85a502aeb47480..db620c0f63203f90c71676f4c8c2cad82f002665 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Tue Mar 3 19:31:13 GMT 2009 Daniel P. Berrange + + * src/libvirt.c: Fix return status s/-2/-1/ for virNodeGetSecurityModel + and virDomainGetSecurityLabel() + * src/remote_driver.c:Add missing mutex lock/unlock calls for + virNodeGetSecurityModel and virDomainGetSecurityLabel drivers + Tue Mar 3 16:55:13 GMT 2009 Daniel P. Berrange Mingw32 portability fixes diff --git a/src/libvirt.c b/src/libvirt.c index a19cd89671e537126a04ab095ac56e7a0e06a528..bf3453a06d97c6b5b990ab0624d295fd47af046f 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -4206,7 +4206,7 @@ virDomainGetSecurityLabel(virDomainPtr domain, virSecurityLabelPtr seclabel) return conn->driver->domainGetSecurityLabel(domain, seclabel); virLibConnWarning(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__); - return -2; + return -1; } /** @@ -4236,7 +4236,7 @@ virNodeGetSecurityModel(virConnectPtr conn, virSecurityModelPtr secmodel) return conn->driver->nodeGetSecurityModel(conn, secmodel); virLibConnWarning(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__); - return -2; + return -1; } /** diff --git a/src/remote_internal.c b/src/remote_internal.c index a45e13f7962f039d1ece63bfaaab2e97356386c7..1a8b4e0e243486fc71c1f16a5590f60dca4b62b0 100644 --- a/src/remote_internal.c +++ b/src/remote_internal.c @@ -2302,26 +2302,33 @@ remoteDomainGetSecurityLabel (virDomainPtr domain, virSecurityLabelPtr seclabel) remote_domain_get_security_label_args args; remote_domain_get_security_label_ret ret; struct private_data *priv = domain->conn->privateData; + int rv = -1; + + remoteDriverLock(priv); make_nonnull_domain (&args.dom, domain); memset (&ret, 0, sizeof ret); if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_SECURITY_LABEL, (xdrproc_t) xdr_remote_domain_get_security_label_args, (char *)&args, (xdrproc_t) xdr_remote_domain_get_security_label_ret, (char *)&ret) == -1) { - return -1; + goto done; } if (ret.label.label_val != NULL) { if (strlen (ret.label.label_val) >= sizeof seclabel->label) { errorf (domain->conn, VIR_ERR_RPC, _("security label exceeds maximum: %zd"), sizeof seclabel->label - 1); - return -1; + goto done; } strcpy (seclabel->label, ret.label.label_val); seclabel->enforcing = ret.enforcing; } - return 0; + rv = 0; + +done: + remoteDriverUnlock(priv); + return rv; } static int @@ -2329,19 +2336,22 @@ remoteNodeGetSecurityModel (virConnectPtr conn, virSecurityModelPtr secmodel) { remote_node_get_security_model_ret ret; struct private_data *priv = conn->privateData; + int rv = -1; + + remoteDriverLock(priv); memset (&ret, 0, sizeof ret); if (call (conn, priv, 0, REMOTE_PROC_NODE_GET_SECURITY_MODEL, (xdrproc_t) xdr_void, NULL, (xdrproc_t) xdr_remote_node_get_security_model_ret, (char *)&ret) == -1) { - return -1; + goto done; } if (ret.model.model_val != NULL) { if (strlen (ret.model.model_val) >= sizeof secmodel->model) { errorf (conn, VIR_ERR_RPC, _("security model exceeds maximum: %zd"), sizeof secmodel->model - 1); - return -1; + goto done; } strcpy (secmodel->model, ret.model.model_val); } @@ -2350,11 +2360,16 @@ remoteNodeGetSecurityModel (virConnectPtr conn, virSecurityModelPtr secmodel) if (strlen (ret.doi.doi_val) >= sizeof secmodel->doi) { errorf (conn, VIR_ERR_RPC, _("security doi exceeds maximum: %zd"), sizeof secmodel->doi - 1); - return -1; + goto done; } strcpy (secmodel->doi, ret.doi.doi_val); } - return 0; + + rv = 0; + +done: + remoteDriverUnlock(priv); + return rv; } static char *