mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 06:56:14 +01:00
gtestutils: Check for failure to setenv() and return
This is very unlikely to happen, but it makes Coverity happier. Signed-off-by: Philip Withnall <pwithnall@endlessos.org> Coverity CID: #1474388
This commit is contained in:
parent
a0dbaeed2f
commit
b012c3470b
@ -1684,7 +1684,12 @@ void
|
||||
g_free (tmpl);
|
||||
|
||||
/* Propagate the temporary directory to subprocesses. */
|
||||
g_setenv ("G_TEST_TMPDIR", test_isolate_dirs_tmpdir, TRUE);
|
||||
if (!g_setenv ("G_TEST_TMPDIR", test_isolate_dirs_tmpdir, TRUE))
|
||||
{
|
||||
g_printerr ("%s: Failed to set environment variable ‘%s’\n",
|
||||
(*argv)[0], "G_TEST_TMPDIR");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/* And clear the traditional environment variables so subprocesses
|
||||
* spawned by the code under test can’t trash anything. If a test
|
||||
@ -1710,7 +1715,14 @@ void
|
||||
gsize i;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (overridden_environment_variables); i++)
|
||||
g_setenv (overridden_environment_variables[i], "/dev/null", TRUE);
|
||||
{
|
||||
if (!g_setenv (overridden_environment_variables[i], "/dev/null", TRUE))
|
||||
{
|
||||
g_printerr ("%s: Failed to set environment variable ‘%s’\n",
|
||||
(*argv)[0], overridden_environment_variables[i]);
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user