From patchwork Sun Jun 5 18:46:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 16316 X-Patchwork-Delegate: sw@simonwunderlich.de Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from open-mesh.org (localhost [IPv6:::1]) by open-mesh.org (Postfix) with ESMTP id A3AA281AEF; Sun, 5 Jun 2016 20:47:20 +0200 (CEST) Authentication-Results: open-mesh.org; dmarc=none header.from=narfation.org Authentication-Results: open-mesh.org; dkim=fail reason="verification failed; unprotected key" header.d=narfation.org header.i=@narfation.org header.b=TxvkZjDx; dkim-adsp=fail (unprotected policy); dkim-atps=neutral Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=79.140.41.39; helo=v3-1039.vlinux.de; envelope-from=sven@narfation.org; receiver=b.a.t.m.a.n@lists.open-mesh.org Authentication-Results: open-mesh.org; dmarc=pass header.from=narfation.org Received: from v3-1039.vlinux.de (narfation.org [79.140.41.39]) by open-mesh.org (Postfix) with ESMTPS id 894E981AC9 for ; Sun, 5 Jun 2016 20:47:18 +0200 (CEST) Received: from sven-desktop.home.narfation.org (p4FCB293D.dip0.t-ipconnect.de [79.203.41.61]) by v3-1039.vlinux.de (Postfix) with ESMTPSA id E22251100E8; Sun, 5 Jun 2016 20:47:17 +0200 (CEST) Authentication-Results: v3-1039.vlinux.de; dmarc=none header.from=narfation.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=narfation.org; s=20121; t=1465152438; bh=ksmeXN3dPPpgzzmL6w717Mpw+dfUMArqids17AJk0pg=; h=From:To:Cc:Subject:Date:From; b=TxvkZjDxhYIClXnR/IBDXr7/jqPjZk1SwdU/9lUqsOqO5pzUepzYXhWVYWO5r8wvR 5qrjk/y4hfwn7e9Ku7WmbzDYhxasYO5Efx1voZJTgqiqP3a7p1HZOSbYK6zaqEAs1t e2t148KA4EPiyudTy/hkKS9LvtrHWLmMQS0Hl79A= From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Sun, 5 Jun 2016 20:46:59 +0200 Message-Id: <1465152428-17299-1-git-send-email-sven@narfation.org> X-Mailer: git-send-email 2.8.1 Subject: [B.A.T.M.A.N.] [PATCH 01/10] alfred: vis: Fix parsing of iface_status X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking Errors-To: b.a.t.m.a.n-bounces@lists.open-mesh.org Sender: "B.A.T.M.A.N" 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 --- 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);