From patchwork Tue Feb 7 22:54:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 9561359 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 062C76047A for ; Tue, 7 Feb 2017 22:54:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E634128472 for ; Tue, 7 Feb 2017 22:54:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D775028488; Tue, 7 Feb 2017 22:54:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_TVD_MIME_EPI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 445AF28472 for ; Tue, 7 Feb 2017 22:54:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753026AbdBGWy4 (ORCPT ); Tue, 7 Feb 2017 17:54:56 -0500 Received: from mx2.suse.de ([195.135.220.15]:59350 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752108AbdBGWyz (ORCPT ); Tue, 7 Feb 2017 17:54:55 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id A1BB7ABD3; Tue, 7 Feb 2017 22:54:53 +0000 (UTC) From: NeilBrown To: steved@redhat.com Date: Wed, 08 Feb 2017 09:54:47 +1100 Cc: Linux NFS Mailing Subject: [PATCH] conffile: ignore empty environment variables. Message-ID: <87a89xwr0o.fsf@notabene.neil.brown.name> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP conf_set() already refuses to set an empty value, so if foo= appears in the config file, it will be ignored. This patch extends the policy to environment variables, so empty environment variables are treated as though they didn't exist. This means that a separate environment file (e.g. /etc/sysconfig/nfs) will be treated the same way whether it is: - included in the [environment] section of /etc/nfs.conf - sourced by the shell before running code - sourced by the systemd EnvironmentFile directive. Signed-off-by: NeilBrown --- support/nfs/conffile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support/nfs/conffile.c b/support/nfs/conffile.c index e717c1e39bab..203efd2aa602 100644 --- a/support/nfs/conffile.c +++ b/support/nfs/conffile.c @@ -533,7 +533,7 @@ retry: * or from environment */ char *env = getenv(cb->value+1); - if (env) + if (env && *env) return env; section = "environment"; tag = cb->value + 1;