ostree: check g_setenv return value

This adds proper return-value checks on g_setenv calls.
It fixes a static analysis warning highlighted by Coverity.
This commit is contained in:
Luca BRUNO committed 2022-01-10 13:33:36 +00:00
1 parent 92025018f6
commit 0bdba574d7
6 files changed
+17 -6

No files matched your search

+2 -1
View File
@@ -155,7 +155,8 @@ ot_test_setup_sysroot (GCancellable *cancellable,
}
/* Make sure deployments are mutable */
g_setenv ("OSTREE_SYSROOT_DEBUG", buf->str, TRUE);
if (!g_setenv ("OSTREE_SYSROOT_DEBUG", buf->str, TRUE))
return glnx_null_throw (error, "Failed to set environment variable OSTREE_SYSROOT_DEBUG");
g_autoptr(GFile) sysroot_path = g_file_new_for_path ("sysroot");
return ostree_sysroot_new (sysroot_path);
+2 -1
View File
@@ -78,7 +78,8 @@ test_fixture_setup (TestFixture *fixture,
* certificates for certain test cases. */
homedir = g_test_build_filename (G_TEST_DIST, "tests/gpg-verify-data", NULL);
g_setenv ("GNUPGHOME", homedir, TRUE);
gboolean is_ok = g_setenv ("GNUPGHOME", homedir, TRUE);
g_assert (is_ok == TRUE);
result = g_initable_new (OSTREE_TYPE_GPG_VERIFY_RESULT,
NULL, &local_error, NULL);
+2 -1
View File
@@ -35,7 +35,8 @@ main (int argc, char **argv)
OstreeRollsumMatches *matches;
GMappedFile *mfile;
g_setenv ("GIO_USE_VFS", "local", TRUE);
gboolean is_ok = g_setenv ("GIO_USE_VFS", "local", TRUE);
g_assert (is_ok == TRUE);
if (argc < 3)
return 1;
+2 -1
View File
@@ -58,7 +58,8 @@ int
main (int argc, char **argv)
{
g_setenv ("GIO_USE_VFS", "local", TRUE);
gboolean is_ok = g_setenv ("GIO_USE_VFS", "local", TRUE);
g_assert (is_ok == TRUE);
g_test_init (&argc, &argv, NULL);