diff options
author | Linus Nordberg <linus@nordberg.se> | 2013-08-28 13:48:49 +0200 |
---|---|---|
committer | Linus Nordberg <linus@nordberg.se> | 2013-09-06 15:16:41 +0200 |
commit | 43446949664ce2000fa6cd7c62687355c2c440e2 (patch) | |
tree | f42380cbde2144c20d93dcad52e3eb9523e06dcd /radmsg.c | |
parent | 26c8061a9b931a817756946863fea057dd81b656 (diff) |
Have radmsg_copy_attrs() return error in all error cases.
Also when copying of the first attribute fails.
Diffstat (limited to 'radmsg.c')
-rw-r--r-- | radmsg.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -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) @@ -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++; |