diff options
author | Luca BRUNO <luca.bruno@coreos.com> | 2022-01-10 10:22:28 +0000 |
---|---|---|
committer | Luca BRUNO <luca.bruno@coreos.com> | 2022-01-10 13:33:36 +0000 |
commit | 0bdba574d735ae37447d4c1e8bd0b6a4e622da79 (patch) | |
tree | 197674a5e932e37afe0b11b95575570de3a688af /src/libostree/ostree-sepolicy.c | |
parent | 92025018f6c64b608ef7f8d8fab27dc18ee90c7f (diff) | |
download | ostree-0bdba574d735ae37447d4c1e8bd0b6a4e622da79.tar.gz |
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.
Diffstat (limited to 'src/libostree/ostree-sepolicy.c')
-rw-r--r-- | src/libostree/ostree-sepolicy.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libostree/ostree-sepolicy.c b/src/libostree/ostree-sepolicy.c index d8ff35cb..0fed6457 100644 --- a/src/libostree/ostree-sepolicy.c +++ b/src/libostree/ostree-sepolicy.c @@ -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); |