[v2,3/3] batctl: Fix substitution of mac addresses with a following ')'
Commit Message
So far, mac addresses which had a following closing bracket and not a
comma were ignored for the bat-hosts substitutions. This commit allows
the substitution of such mac addresses, too.
Signed-off-by: Linus Lüssing <linus.luessing@ascom.ch>
---
functions.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
@@ -177,9 +177,17 @@ read:
*space_ptr = '\0';
extra_char = '\0';
- if ((strlen(buff_ptr) == ETH_STR_LEN + 1) && (buff_ptr[ETH_STR_LEN] == ',')) {
- extra_char = ',';
- buff_ptr[ETH_STR_LEN] = '\0';
+ if (strlen(buff_ptr) == ETH_STR_LEN + 1) {
+ extra_char = buff_ptr[ETH_STR_LEN];
+ switch (extra_char) {
+ case ',':
+ case ')':
+ buff_ptr[ETH_STR_LEN] = '\0';
+ break;
+ default:
+ extra_char = '\0';
+ break;
+ }
}
if (strlen(buff_ptr) != ETH_STR_LEN)