Eric Sunshine writes:
> However, you might also consider using xstrdup_or_null(), like this:
>
> external_diff_cmd = xstrdup_or_null(getenv(...));
> if (!external_diff_cmd)
> ...as before...
>
>> done_preparing = 1;
>> return external_diff_cmd;
>> }
Looks good.
Hi,
On Wed, 9 Jan 2019, Eric Sunshine wrote:
> On Wed, Jan 9, 2019 at 5:19 PM Kim Gybels wrote:
> > According to getenv(3)'s notes:
> > [...]
> > Since strings returned by getenv() are allowed to change on subsequent
> > calls to getenv(), make sure to duplicate when caching external_diff_cmd
>
On Wed, Jan 9, 2019 at 5:19 PM Kim Gybels wrote:
> According to getenv(3)'s notes:
> [...]
> Since strings returned by getenv() are allowed to change on subsequent
> calls to getenv(), make sure to duplicate when caching external_diff_cmd
> from environment.
> [...]
> Signed-off-by: Kim Gybels
>
According to getenv(3)'s notes:
The implementation of getenv() is not required to be reentrant. The
string pointed to by the return value of getenv() may be statically
allocated, and can be modified by a subsequent call to getenv(),
putenv(3), setenv(3), or unsetenv(3).
Since str
4 matches
Mail list logo