From d96d2c98ebc4c2d3765f5b35c4142e0e828a421b Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Wed, 14 Sep 2011 11:52:43 +0200 Subject: shared.c: Only setenv() if value is non-null Some setenv() implementations (e.g. the one in OpenBSD's stdlib) segfault if we pass a NULL value. Only set environment variables if the corresponding settings are defined to avoid this. Note that this is a minor behaviour change as environment variables were supposed to be set to an empty string if a setting was undefined. Given that this feature isn't part of any official release yet, there's no need to worry about backwards compatibility, really. Change the documentation accordingly. Signed-off-by: Lukas Fleischer --- shared.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'shared.c') diff --git a/shared.c b/shared.c index 75c4b5c..0c8ce3e 100644 --- a/shared.c +++ b/shared.c @@ -392,7 +392,7 @@ void cgit_prepare_repo_env(struct cgit_repo * repo) p = env_vars; q = p + env_var_count; for (; p < q; p++) - if (setenv(p->name, p->value, 1)) + if (p->value && setenv(p->name, p->value, 1)) fprintf(stderr, warn, p->name, p->value); } -- cgit v1.2.1