Merge pull request #1933 from cgwalters/scan-build-0

A few more scan-build fixes
This commit is contained in:
OpenShift Merge Robot 2019-10-15 17:59:00 +02:00 committed by GitHub
commit 72c7619bff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 10 deletions

View File

@ -871,7 +871,10 @@ write_content_object (OstreeRepo *self,
/* Give a null input if there's no content */
g_autoptr(GInputStream) null_input = NULL;
if (!input)
null_input = input = g_memory_input_stream_new_from_data ("", 0, NULL);
{
null_input = input = g_memory_input_stream_new_from_data ("", 0, NULL);
(void) null_input; /* quiet static analysis */
}
checksum_input = ot_checksum_instream_new_with_start (input, G_CHECKSUM_SHA256,
buf, len);

View File

@ -4197,7 +4197,7 @@ ostree_repo_has_object (OstreeRepo *self,
GCancellable *cancellable,
GError **error)
{
gboolean ret_have_object;
gboolean ret_have_object = FALSE;
if (!_ostree_repo_has_loose_object (self, checksum, objtype, &ret_have_object,
cancellable, error))

View File

@ -753,15 +753,14 @@ prepare_deployment_etc (OstreeSysroot *sysroot,
return FALSE;
gboolean usretc_exists = (errno == 0);
if (etc_exists && usretc_exists)
return glnx_throw (error, "Tree contains both /etc and /usr/etc");
else if (etc_exists)
if (etc_exists)
{
if (usretc_exists)
return glnx_throw (error, "Tree contains both /etc and /usr/etc");
/* Compatibility hack */
if (!glnx_renameat (deployment_dfd, "etc", deployment_dfd, "usr/etc", error))
return FALSE;
usretc_exists = TRUE;
etc_exists = FALSE;
}
if (usretc_exists)

View File

@ -1671,10 +1671,7 @@ ostree_sysroot_simple_write_deployment (OstreeSysroot *sysroot,
/* add it last if no crossover defined (or it's the first deployment in the sysroot) */
if (!added_new)
{
g_ptr_array_add (new_deployments, g_object_ref (new_deployment));
added_new = TRUE;
}
g_ptr_array_add (new_deployments, g_object_ref (new_deployment));
OstreeSysrootWriteDeploymentsOpts write_opts = { .do_postclean = postclean };
if (!ostree_sysroot_write_deployments_with_options (sysroot, new_deployments, &write_opts,