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 <[email protected]> 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])
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to