Skip to content

Commit

Permalink
Have radmsg_copy_attrs() return error in all error cases.
Browse files Browse the repository at this point in the history
Also when copying of the first attribute fails.
  • Loading branch information
Linus Nordberg committed Sep 6, 2013
1 parent 26c8061 commit 4344694
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions radmsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,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)
Expand All @@ -119,7 +117,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++;
Expand Down

0 comments on commit 4344694

Please sign in to comment.