From: Razvan Deaconescu Date: Tue, 29 Nov 2022 20:34:46 +0000 (+0200) Subject: Add patch to fix definition of environ variable X-Git-Tag: RELEASE-0.11.0~1 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=980bf21159e0a366c20241d98e3a57e35009932a;p=unikraft%2Flibs%2Fmusl.git Add patch to fix definition of environ variable The patch properly defines `environ` as an array of pointers, the last of which is NULL. In the previous definition, `environ` was NULL, which is not OK. The definition is now replaced to an array of a single NULL element. Signed-off-by: Razvan Deaconescu Reviewed-by: Stefan Jumarea Approved-by: Simon Kuenzer Tested-by: Unikraft CI GitHub-Closes: #30 --- diff --git a/patches/0021-src-env-Properly-define-environ-variable.patch b/patches/0021-src-env-Properly-define-environ-variable.patch new file mode 100644 index 0000000..65f8ded --- /dev/null +++ b/patches/0021-src-env-Properly-define-environ-variable.patch @@ -0,0 +1,34 @@ +From 17ebbfdf54bf48906e9a794858e82a22b4a79e92 Mon Sep 17 00:00:00 2001 +Message-Id: <17ebbfdf54bf48906e9a794858e82a22b4a79e92.1669753860.git.razvand@unikraft.io> +From: Razvan Deaconescu +Date: Tue, 29 Nov 2022 22:29:40 +0200 +Subject: [PATCH] src/env: Properly define environ variable + +`environ` is an array of pointers, the last element of which is the NULL +pointer. The current definition of `environ` defines it as NULL, not as +an array of pointers. + +This commit changes that, and defines `environ` as an array with a +single NULL element. + +Signed-off-by: Razvan Deaconescu +--- + src/env/__environ.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/env/__environ.c b/src/env/__environ.c +index e6c6faa..689b834 100644 +--- a/src/env/__environ.c ++++ b/src/env/__environ.c +@@ -1,6 +1,7 @@ + #include "libc.h" + +-char **__environ = 0; ++static char *init_environ[] = { NULL }; ++char **__environ = init_environ; + weak_alias(__environ, ___environ); + weak_alias(__environ, _environ); + weak_alias(__environ, environ); +-- +2.17.1 +