Re: [PATCH 1/6] get_super_prefix(): copy getenv() result
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 12, 2019, 03:02 UTC
- Message-ID
- <xmqqwonawpbd.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20190111221500.GA10188@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 8 quoted lines
> The return value of getenv() is not guaranteed to remain valid across > multiple calls (nor across calls to setenv()). Since this function > caches the result for the length of the program, we must make a copy to > ensure that it is still valid when we need it. > > Reported-by: Yngve N. Pettersen <yngve@vivaldi.com> > Signed-off-by: Jeff King <peff@peff.net> > ---
Makes sense. Thanks.