]> git.ipfire.org Git - thirdparty/curl.git/commit
tool_homedir: Change GetEnv() to use libcurl's curl_getenv()
authorJay Satiro <raysatiro@yahoo.com>
Wed, 29 Jan 2020 08:23:55 +0000 (03:23 -0500)
committerJay Satiro <raysatiro@yahoo.com>
Wed, 12 Feb 2020 23:37:31 +0000 (18:37 -0500)
commit9dc350b60c1345aea548847de414c55468a4d123
tree0f2b5f439f83ab148dcb158e2d63342d752a8658
parent39d5621cbd81ff456d295af7c648a31215958c93
tool_homedir: Change GetEnv() to use libcurl's curl_getenv()

- Deduplicate GetEnv() code.

- On Windows change ultimate call to use Windows API
  GetEnvironmentVariable() instead of C runtime getenv().

Prior to this change both libcurl and the tool had their own GetEnv
which over time diverged. Now the tool's GetEnv is a wrapper around
curl_getenv (libcurl API function which is itself a wrapper around
libcurl's GetEnv).

Furthermore this change fixes a bug in that Windows API
GetEnvironmentVariable() is called instead of C runtime getenv() to get
the environment variable since some changes aren't always visible to the
latter.

Reported-by: Christoph M. Becker
Fixes https://github.com/curl/curl/issues/4774
Closes https://github.com/curl/curl/pull/4863
lib/getenv.c
src/tool_homedir.c