cluster: STABLE32 - rgmanager: reslist: nothing avoids using size_t
Ryan McCabe
rmccabe at fedoraproject.org
Tue May 1 19:20:57 UTC 2012
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=efa9aed4cfb5a4501ccc2862a477eb5c370f0690
Commit: efa9aed4cfb5a4501ccc2862a477eb5c370f0690
Parent: bff872891fc58d3f8895361e562be7c8416c937b
Author: Jan Pokorný <jpokorny at redhat.com>
AuthorDate: Fri Apr 6 19:44:20 2012 +0200
Committer: Ryan McCabe <rmccabe at redhat.com>
CommitterDate: Tue May 1 15:20:43 2012 -0400
rgmanager: reslist: nothing avoids using size_t
+ fix comment typo
Signed-off-by: Jan Pokorný <jpokorny at redhat.com>
Signed-off-by: Ryan McCabe <rmccabe at redhat.com>
---
rgmanager/src/daemons/reslist.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/rgmanager/src/daemons/reslist.c b/rgmanager/src/daemons/reslist.c
index e1695fb..f9924cd 100644
--- a/rgmanager/src/daemons/reslist.c
+++ b/rgmanager/src/daemons/reslist.c
@@ -70,7 +70,7 @@ _attr_value(resource_node_t *node, const char *attrname, const char *ptype)
resource_t *res;
resource_attr_t *ra;
char *c, p_type[32];
- ssize_t len;
+ size_t len;
int x;
if (!node)
@@ -99,11 +99,13 @@ _attr_value(resource_node_t *node, const char *attrname, const char *ptype)
c = strchr(ra->ra_value, '%');
if (!c) {
/* Someone doesn't care or uses older
- semantics on inheritance */
+ semantics of inheritance */
return _attr_value(node->rn_parent, ra->ra_value,
NULL);
}
+ /* Difference guaranteed to be non-negative
+ (for x >= 0: &ra->ra_value[x] >= &ra->ra_value[0]) */
len = (c - ra->ra_value);
memset(p_type, 0, sizeof(p_type));
memcpy(p_type, ra->ra_value, len);
More information about the cluster-commits
mailing list