[v2,3/3] batctl: Fix substitution of mac addresses with a following ')'

Message ID 1290514400-6887-4-git-send-email-linus.luessing@ascom.ch (mailing list archive)
State Accepted, archived
Commit b84133dce161872604086bddc3b960da9b2dc04e
Headers

Commit Message

Linus Lüssing Nov. 23, 2010, 12:13 p.m. UTC
  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(-)
  

Patch

diff --git a/functions.c b/functions.c
index 9b1e22b..52cfe4b 100644
--- a/functions.c
+++ b/functions.c
@@ -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)