* [PATCH] conffile: ignore empty environment variables.
@ 2017-02-07 22:54 NeilBrown
2017-02-16 10:22 ` Steve Dickson
0 siblings, 1 reply; 2+ messages in thread
From: NeilBrown @ 2017-02-07 22:54 UTC (permalink / raw)
To: steved; +Cc: Linux NFS Mailing
[-- Attachment #1: Type: text/plain, Size: 1053 bytes --]
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 <neilb@suse.com>
---
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;
--
2.11.0
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] conffile: ignore empty environment variables.
2017-02-07 22:54 [PATCH] conffile: ignore empty environment variables NeilBrown
@ 2017-02-16 10:22 ` Steve Dickson
0 siblings, 0 replies; 2+ messages in thread
From: Steve Dickson @ 2017-02-16 10:22 UTC (permalink / raw)
To: NeilBrown; +Cc: Linux NFS Mailing
On 02/07/2017 05:54 PM, NeilBrown wrote:
> 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 <neilb@suse.com>
Committed...
steved.
> ---
> 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;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-02-16 10:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-07 22:54 [PATCH] conffile: ignore empty environment variables NeilBrown
2017-02-16 10:22 ` Steve Dickson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).