tree-wide: Fix some "Dead assignment" from clang-analyzer

The `have_rpmdb` one was a leftover looks like.  In the `disabled_all_repos`
case it was clearly there for symmetry, but eh; it seems somewhat
unlikely that we add a *3rd* case there.  Also while we're
here change it to C++ `bool` so tools like analyzers know it really
is a boolean.
This commit is contained in:
Colin Walters 2021-02-05 14:00:42 +00:00 committed by OpenShift Merge Robot
parent 7b5b35210b
commit a36f9716c6
2 changed files with 4 additions and 9 deletions

View File

@ -778,7 +778,7 @@ rpmostree_context_setup (RpmOstreeContext *self,
/* Makes sure we only disable all repos once. This is more for future proofing against
* refactors for now since we don't support `lockfile-repos` on the client-side and on
* the server-side we always require `repos` anyway. */
gboolean disabled_all_repos = FALSE;
bool disabled_all_repos = false;
/* NB: missing "repos" --> let libdnf figure it out for itself (we're likely doing a
* client-side compose where we want to use /etc/yum.repos.d/) */
@ -788,7 +788,7 @@ rpmostree_context_setup (RpmOstreeContext *self,
if (!disabled_all_repos)
{
disable_all_repos (self);
disabled_all_repos = TRUE;
disabled_all_repos = true;
}
if (!enable_repos (self, (const char *const*)enabled_repos, error))
return FALSE;
@ -802,10 +802,7 @@ rpmostree_context_setup (RpmOstreeContext *self,
if (g_variant_dict_lookup (self->spec->dict, "lockfile-repos", "^a&s", &enabled_lockfile_repos))
{
if (!disabled_all_repos)
{
disable_all_repos (self);
disabled_all_repos = TRUE;
}
disable_all_repos (self);
if (!enable_repos (self, (const char *const*)enabled_lockfile_repos, error))
return FALSE;
}

View File

@ -1286,10 +1286,9 @@ rpmostree_rootfs_postprocess_common (int rootfs_fd,
if (!rename_if_exists (rootfs_fd, "etc", rootfs_fd, "usr/etc", error))
return FALSE;
gboolean have_rpmdb;
if (!glnx_fstatat_allow_noent (rootfs_fd, RPMOSTREE_RPMDB_LOCATION, NULL, AT_SYMLINK_NOFOLLOW, error))
return FALSE;
have_rpmdb = (errno == 0);
const bool have_rpmdb = (errno == 0);
if (!have_rpmdb)
{
/* Try looking in var/lib/rpm */
@ -1302,7 +1301,6 @@ rpmostree_rootfs_postprocess_common (int rootfs_fd,
return FALSE;
if (symlinkat ("../../" RPMOSTREE_RPMDB_LOCATION, rootfs_fd, "var/lib/rpm") < 0)
return glnx_throw_errno_prefix (error, "symlinkat(%s)", "var/lib/rpm");
have_rpmdb = TRUE;
}
}