Re: [PATCH] Fix "t0001: test git init when run via an alias"
Oops; obviously the check must be for NULL-ness, i.e.
if (!getcwd(...))
die_errno(...);
On Tue, Jun 10, 2014 at 11:53 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 19 quoted lines
> I'd squash this in, though.
>
> git.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/git.c b/git.c
> index 6bb2043..9bfa8fb 100644
> --- a/git.c
> +++ b/git.c
> @@ -36,7 +36,8 @@ static void save_env(void)
> if (saved_environment)
> return;
> saved_environment = 1;
> - getcwd(orig_cwd, sizeof(orig_cwd));
> + if (getcwd(orig_cwd, sizeof(orig_cwd)))
> + die_errno("cannot getcwd");
> for (i = 0; i < ARRAY_SIZE(env_names); i++) {
> orig_env[i] = getenv(env_names[i]);
> if (orig_env[i])