summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordberg.se>2013-08-28 13:48:49 +0200
committerLinus Nordberg <linus@nordberg.se>2013-09-06 15:14:33 +0200
commit4b41cda616a176b9f8a7ad86295a852840ca83c7 (patch)
treed1afbed383ce75559ac5342a23c21d821d586e11
parent1564b8b405852d78acb4cd7443922b9bb12372ad (diff)
Have radmsg_copy_attrs() return error in all error cases.
Also when copying of the first attribute fails.
-rw-r--r--radmsg.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/radmsg.c b/radmsg.c
index e95ea59..cd01861 100644
--- a/radmsg.c
+++ b/radmsg.c
@@ -101,9 +101,7 @@ struct tlv *radmsg_gettype(struct radmsg *msg, uint8_t type) {
* If all attributes were copied successfully, the number of
* attributes copied is returned.
*
- * If copying failed, a negative number is returned. The number
- * returned is 0 minus the number of attributes successfully copied
- * before the failure. */
+ * If copying failed, a negative number is returned. */
int radmsg_copy_attrs(struct radmsg *dst,
const struct radmsg *src,
uint8_t type)
@@ -114,7 +112,7 @@ int radmsg_copy_attrs(struct radmsg *dst,
for (node = list_first(list); node; node = list_next(node)) {
if (radmsg_add(dst, copytlv((struct tlv *) node->data)) != 1) {
- n = -n;
+ n = -1;
break;
}
n++;