Repository : ssh://git@open-mesh.org/alfred
On branch : master
commit f34d03efa7e6a1f1f9f912a3bf15deb612434bc8 Author: Sven Eckelmann sven@narfation.org Date: Sun Jun 5 20:46:59 2016 +0200
alfred: vis: Fix parsing of iface_status
The content of batman_adv/iface_status ends with a newline. Thus register_interfaces has to make sure that it only compares the first line without the \n when comparing with the status string.
Signed-off-by: Sven Eckelmann sven@narfation.org Signed-off-by: Simon Wunderlich sw@simonwunderlich.de
f34d03efa7e6a1f1f9f912a3bf15deb612434bc8 vis/vis.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/vis/vis.c b/vis/vis.c index 4d494bc..7eab781 100644 --- a/vis/vis.c +++ b/vis/vis.c @@ -257,6 +257,7 @@ static int register_interfaces(struct globals *globals) DIR *iface_base_dir; struct dirent *iface_dir; char *path_buff, *file_content; + char *content_newline;
path_buff = malloc(PATH_BUFF_LEN); if (!path_buff) { @@ -295,6 +296,10 @@ static int register_interfaces(struct globals *globals) if (!file_content) continue;
+ content_newline = strstr(file_content, "\n"); + if (content_newline) + *content_newline = '\0'; + if (strcmp(file_content, "active") == 0) get_if_index(globals, iface_dir->d_name);