Also, please don't use !strcmp(a,b), because it confuses me. Better is to write strcmp(a,b) == 0 to mean "strings match" and strcmp(a,b) != 0 to mean "strings don't match".
Rich. -- Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/ Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 03798903
Index: src/xen_internal.c =================================================================== RCS file: /data/cvs/libvirt/src/xen_internal.c,v retrieving revision 1.79 diff -u -r1.79 xen_internal.c --- src/xen_internal.c 6 Jun 2007 12:24:31 -0000 1.79 +++ src/xen_internal.c 22 Jun 2007 09:25:45 -0000 @@ -1071,8 +1071,6 @@ virSchedParameterPtr params, int *nparams) { xenUnifiedPrivatePtr priv; - char str_weight[] ="weight"; - char str_cap[] ="cap"; if ((domain == NULL) || (domain->conn == NULL)) { virXenErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__, @@ -1126,11 +1124,11 @@ if (ret < 0) return(-1); - strncpy(params[0].field, str_weight, strlen(str_weight)); + strcpy (params[0].field, "weight"); params[0].type = VIR_DOMAIN_SCHED_FIELD_UINT; params[0].value.ui = op_dom.u.getschedinfo.u.credit.weight; - strncpy(params[1].field, str_cap, strlen(str_cap)); + strcpy (params[1].field, "cap"); params[1].type = VIR_DOMAIN_SCHED_FIELD_UINT; params[1].value.ui = op_dom.u.getschedinfo.u.credit.cap; @@ -1161,8 +1159,6 @@ { int i; xenUnifiedPrivatePtr priv; - char str_weight[] ="weight"; - char str_cap[] ="cap"; if ((domain == NULL) || (domain->conn == NULL)) { virXenErrorFunc (VIR_ERR_INTERNAL_ERROR, __FUNCTION__, @@ -1227,11 +1223,11 @@ op_dom.u.getschedinfo.u.credit.cap = (uint16_t)~0U; for (i = 0; i < nparams; i++) { - if (!strncmp(params[i].field,str_weight,strlen(str_weight)) && + if (strcmp(params[i].field, "weight") == 0 && params[i].type == VIR_DOMAIN_SCHED_FIELD_UINT) { op_dom.u.getschedinfo.u.credit.weight = params[i].value.ui; weight_set = 1; - } else if (!strncmp(params[i].field,str_cap,strlen(str_cap)) && + } else if (strcmp(params[i].field, "cap") == 0 && params[i].type == VIR_DOMAIN_SCHED_FIELD_UINT) { op_dom.u.getschedinfo.u.credit.cap = params[i].value.ui; cap_set = 1;
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature