[ACM] Don't use uninitialised struct value if hypercall fails.

From: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
This commit is contained in:
kfraser@localhost.localdomain committed 2006-10-23 09:57:24 +01:00
1 parent a3fc4d842e
commit 94ee555a3a
1 file changed
+11 -6
+11 -6
View File
@@ -147,9 +147,10 @@ static PyObject *getdecision(PyObject * self, PyObject * args)
{
char *arg1_name, *arg1, *arg2_name, *arg2, *decision = NULL;
struct acm_getdecision getdecision;
int xc_handle;
int xc_handle, rc;
if (!PyArg_ParseTuple(args, "ssss", &arg1_name, &arg1, &arg2_name, &arg2)) {
if (!PyArg_ParseTuple(args, "ssss", &arg1_name,
&arg1, &arg2_name, &arg2)) {
return NULL;
}
@@ -179,13 +180,17 @@ static PyObject *getdecision(PyObject * self, PyObject * args)
getdecision.id2.ssidref = atol(arg2);
}
if (xc_acm_op(xc_handle, ACMOP_getdecision, &getdecision, sizeof(getdecision)) < 0) {
if (errno == EACCES)
PERROR("ACM operation failed.");
}
rc = xc_acm_op(xc_handle, ACMOP_getdecision,
&getdecision, sizeof(getdecision));
xc_interface_close(xc_handle);
if (rc < 0) {
if (errno == EACCES)
PERROR("ACM operation failed.");
return NULL;
}
if (getdecision.acm_decision == ACM_ACCESS_PERMITTED)
decision = "PERMITTED";
else if (getdecision.acm_decision == ACM_ACCESS_DENIED)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.