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:
6 files changed
+17
-6
No files matched your search
@@ -422,7 +422,10 @@ initable_init (GInitable *initable,
|
||||
{
|
||||
const char *policy_rootpath = gs_file_get_path_cached (policy_root);
|
||||
|
||||
g_setenv ("LIBSELINUX_DISABLE_PCRE_PRECOMPILED", "1", FALSE);
|
||||
/* TODO(lucab): get rid of this setenv(), it may be unsafe in a multi-thread context. */
|
||||
if (!g_setenv ("LIBSELINUX_DISABLE_PCRE_PRECOMPILED", "1", FALSE))
|
||||
return glnx_throw (error, "Failed to set environment variable LIBSELINUX_DISABLE_PCRE_PRECOMPILED");
|
||||
|
||||
if (selinux_set_policy_root (policy_rootpath) != 0)
|
||||
return glnx_throw_errno_prefix (error, "selinux_set_policy_root(%s)", policy_rootpath);
|
||||
|
||||
|
||||
@@ -253,7 +253,11 @@ ostree_run (int argc,
|
||||
int in, out;
|
||||
|
||||
/* avoid gvfs (http://bugzilla.gnome.org/show_bug.cgi?id=526454) */
|
||||
g_setenv ("GIO_USE_VFS", "local", TRUE);
|
||||
if (!g_setenv ("GIO_USE_VFS", "local", TRUE))
|
||||
{
|
||||
(void) glnx_throw (res_error, "Failed to set environment variable GIO_USE_FVS");
|
||||
return 1;
|
||||
}
|
||||
|
||||
g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, message_handler, NULL);
|
||||
|
||||
|
||||
Reference in new issue
Block a user