From patchwork Thu Aug 8 19:40:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yann Droneaud X-Patchwork-Id: 2841363 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CB7C59F271 for ; Thu, 8 Aug 2013 19:53:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9D9AD20362 for ; Thu, 8 Aug 2013 19:53:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 88B1020374 for ; Thu, 8 Aug 2013 19:53:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966259Ab3HHTw7 (ORCPT ); Thu, 8 Aug 2013 15:52:59 -0400 Received: from smtp21.services.sfr.fr ([93.17.128.1]:34256 "EHLO smtp21.services.sfr.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966208Ab3HHTw4 (ORCPT ); Thu, 8 Aug 2013 15:52:56 -0400 Received: from filter.sfr.fr (localhost [127.0.0.1]) by msfrf2106.sfr.fr (SMTP Server) with ESMTP id 9AE5A70000A4; Thu, 8 Aug 2013 21:42:13 +0200 (CEST) Received: from localhost.localdomain (187.20.90.92.rev.sfr.net [92.90.20.187]) by msfrf2106.sfr.fr (SMTP Server) with ESMTP id 20FCB7000082; Thu, 8 Aug 2013 21:42:12 +0200 (CEST) X-SFR-UUID: 20130808194213135.20FCB7000082@msfrf2106.sfr.fr Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.14.7/8.14.7) with ESMTP id r78Jg9b2003055; Thu, 8 Aug 2013 21:42:09 +0200 Received: (from ydroneaud@localhost) by localhost.localdomain (8.14.7/8.14.7/Submit) id r78Jg0l5003053; Thu, 8 Aug 2013 21:42:00 +0200 From: Yann Droneaud To: linux-rdma@vger.kernel.org Cc: Yann Droneaud Subject: [PATCH libibverbs v2 02/11] read_config(): ignore directory entry with backup suffix (~) Date: Thu, 8 Aug 2013 21:40:45 +0200 Message-Id: X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Files ending with a tilde '~' are likely backup files so they should not be considered as valid configuration files. This patch makes read_config() skip backup files in order to protect libibverbs from using 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 ce9e1c0..e67469e 100644 --- a/src/init.c +++ b/src/init.c @@ -309,6 +309,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);