From: Junio C Hamano Date: Tue, 10 Jun 2014 19:09:59 GMT Subject: Re: [PATCH] Fix "t0001: test git init when run via an alias" Message-ID: In-Reply-To: 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 wrote: > 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])