From patchwork Mon May 20 21:43:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yann Droneaud X-Patchwork-Id: 2595011 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id C05D13FD4E for ; Mon, 20 May 2013 21:43:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758417Ab3ETVni (ORCPT ); Mon, 20 May 2013 17:43:38 -0400 Received: from smtp1-g21.free.fr ([212.27.42.1]:58826 "EHLO smtp1-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758406Ab3ETVnh (ORCPT ); Mon, 20 May 2013 17:43:37 -0400 Received: from dworkin.quest-ce.net (unknown [IPv6:2a01:e35:2e9f:6ac0:224:1dff:fe13:dbb2]) by smtp1-g21.free.fr (Postfix) with ESMTP id 130D79400B3; Mon, 20 May 2013 23:43:28 +0200 (CEST) Received: from dworkin.quest-ce.net (localhost [127.0.0.1]) by dworkin.quest-ce.net (8.14.5/8.14.5) with ESMTP id r4KLhQZS009696; Mon, 20 May 2013 23:43:26 +0200 Received: (from ydroneaud@localhost) by dworkin.quest-ce.net (8.14.5/8.14.5/Submit) id r4KLhQK1009695; Mon, 20 May 2013 23:43:26 +0200 From: Yann Droneaud To: linux-rdma@vger.kernel.org Cc: Yann Droneaud Subject: [PATCH 2/3] read_config: ignore directory entry with backup suffix (~) Date: Mon, 20 May 2013 23:43:04 +0200 Message-Id: X-Mailer: git-send-email 1.7.11.7 In-Reply-To: References: Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Try to protect libibverbs from hand modified configuration files. Signed-off-by: Yann Droneaud --- src/init.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/init.c b/src/init.c index c880b68..1981da7 100644 --- a/src/init.c +++ b/src/init.c @@ -311,6 +311,9 @@ static void read_config(void) if (dent->d_name[0] == '.') continue; + if (dent->d_name[0] == '\0' || dent->d_name[strlen(dent->d_name) - 1] == '~') + continue; + if (asprintf(&path, "%s/%s", IBV_CONFIG_DIR, dent->d_name) < 0) { fprintf(stderr, PFX "Warning: couldn't read config file %s/%s.\n", IBV_CONFIG_DIR, dent->d_name);