From patchwork Tue Oct 8 21:30:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 3005481 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0132DBF924 for ; Tue, 8 Oct 2013 21:30:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D0F2020220 for ; Tue, 8 Oct 2013 21:29:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D40292021C for ; Tue, 8 Oct 2013 21:29:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755444Ab3JHV34 (ORCPT ); Tue, 8 Oct 2013 17:29:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:63992 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753581Ab3JHV34 (ORCPT ); Tue, 8 Oct 2013 17:29:56 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r98LTtPi024573 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 8 Oct 2013 17:29:56 -0400 Received: from smallhat.boston.devel.redhat.com.org (vpn-53-5.rdu2.redhat.com [10.10.53.5]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r98LTtAn032123 for ; Tue, 8 Oct 2013 17:29:55 -0400 From: Steve Dickson To: Linux NFS Mailing list Subject: [PATCH 1/2] nfsmount.conf: Remove duplicate 'bg' and 'fg' from parsing string. Date: Tue, 8 Oct 2013 17:30:24 -0400 Message-Id: <1381267825-27457-1-git-send-email-steved@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.2 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 When the 'Background' and/or 'Foreground' options are set in multiple sections of the nfsmount.conf file, each instance gets added to the parsing string. This patch makes the first instance of either option override the any others. Signed-off-by: Steve Dickson --- utils/mount/configfile.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/utils/mount/configfile.c b/utils/mount/configfile.c index 68b9f93..6985ed9 100644 --- a/utils/mount/configfile.c +++ b/utils/mount/configfile.c @@ -164,6 +164,20 @@ add_entry(char *opt) SLIST_INSERT_HEAD(&head, entry, entries); } /* + * Check the alias list to see if the given + * opt is a alias + */ +char *is_alias(char *opt) +{ + int i; + + for (i=0; i < mnt_alias_sz; i++) { + if (strcasecmp(opt, mnt_alias_tab[i].alias) == 0) + return mnt_alias_tab[i].opt; + } + return NULL; +} +/* * See if the given entry exists if the link list, * if so return that entry */ @@ -171,10 +185,21 @@ inline static char *lookup_entry(char *opt) { struct entry *entry; + char *alias = is_alias(opt); SLIST_FOREACH(entry, &head, entries) { if (strcasecmp(entry->opt, opt) == 0) return opt; + if (alias && strcasecmp(entry->opt, alias) == 0) + return opt; + if (alias && strcasecmp(alias, "fg") == 0) { + if (strcasecmp(entry->opt, "bg") == 0) + return opt; + } + if (alias && strcasecmp(alias, "bg") == 0) { + if (strcasecmp(entry->opt, "fg") == 0) + return opt; + } } return NULL; }