mirror of git://gcc.gnu.org/git/gcc.git
libgomp: Handle NULL environ like pointer to NULL pointer [PR111413]
clearenv function just sets environ to NULL (after sometimes freeing it),
rather than setting it to a pointer to NULL, and our code was assuming
it is always non-NULL.
Fixed thusly, the change seems to be large but actually is just
+ if (environ)
for (env = environ; *env != 0; env++)
plus reindentation. I've also noticed the block after this for loop
was badly indented (too much) and fixed that too.
No testcase added, as it needs clearenv + dlopen.
2023-09-19 Jakub Jelinek <jakub@redhat.com>
PR libgomp/111413
* env.c (initialize_env): Don't dereference environ if it is NULL.
Reindent.
(cherry picked from commit 1534598063
)
This commit is contained in:
parent
cefca88f13
commit
c128ad8e83
|
@ -2059,6 +2059,7 @@ initialize_env (void)
|
||||||
none = gomp_get_initial_icv_item (GOMP_DEVICE_NUM_FOR_NO_SUFFIX);
|
none = gomp_get_initial_icv_item (GOMP_DEVICE_NUM_FOR_NO_SUFFIX);
|
||||||
initialize_icvs (&none->icvs);
|
initialize_icvs (&none->icvs);
|
||||||
|
|
||||||
|
if (environ)
|
||||||
for (env = environ; *env != 0; env++)
|
for (env = environ; *env != 0; env++)
|
||||||
{
|
{
|
||||||
if (!startswith (*env, "OMP_"))
|
if (!startswith (*env, "OMP_"))
|
||||||
|
|
Loading…
Reference in New Issue