[01/10] alfred: vis: Fix parsing of iface_status
Commit Message
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>
---
vis/vis.c | 5 +++++
1 file changed, 5 insertions(+)
Comments
On Sunday 05 June 2016 20:46:59 Sven Eckelmann wrote:
> 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>
I've applied the whole series (78e1d64..5b67293). We can beautify the header
stuff later.
Cheers,
Simon
@@ -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);