mirror of
https://github.com/ostreedev/ostree.git
synced 2025-01-03 05:18:24 +03:00
Merge pull request #3265 from lukewarmtemp/2023.8-3-coverity-scan
2023.8-3 coverity scan
This commit is contained in:
commit
9b977e2828
@ -452,7 +452,7 @@ ostree_mutable_tree_ensure_parent_dirs (OstreeMutableTree *self, GPtrArray *spli
|
|||||||
invalidate_contents_checksum (subdir);
|
invalidate_contents_checksum (subdir);
|
||||||
next = ostree_mutable_tree_new ();
|
next = ostree_mutable_tree_new ();
|
||||||
ostree_mutable_tree_set_metadata_checksum (next, metadata_checksum);
|
ostree_mutable_tree_set_metadata_checksum (next, metadata_checksum);
|
||||||
insert_child_mtree (subdir, g_strdup (name), next);
|
insert_child_mtree (subdir, name, next);
|
||||||
}
|
}
|
||||||
|
|
||||||
subdir = next;
|
subdir = next;
|
||||||
|
@ -815,7 +815,7 @@ _try_clone_from_payload_link (OstreeRepo *self, OstreeRepo *dest_repo, const cha
|
|||||||
if (size < OSTREE_SHA256_STRING_LEN + _OSTREE_PAYLOAD_LINK_PREFIX_LEN)
|
if (size < OSTREE_SHA256_STRING_LEN + _OSTREE_PAYLOAD_LINK_PREFIX_LEN)
|
||||||
return glnx_throw (error, "invalid data size for %s", loose_path_buf);
|
return glnx_throw (error, "invalid data size for %s", loose_path_buf);
|
||||||
|
|
||||||
sprintf (target_checksum, "%.2s%.62s", target_buf + _OSTREE_PAYLOAD_LINK_PREFIX_LEN,
|
snprintf (target_checksum, size, "%.2s%.62s", target_buf + _OSTREE_PAYLOAD_LINK_PREFIX_LEN,
|
||||||
target_buf + _OSTREE_PAYLOAD_LINK_PREFIX_LEN + 3);
|
target_buf + _OSTREE_PAYLOAD_LINK_PREFIX_LEN + 3);
|
||||||
|
|
||||||
_ostree_loose_path (loose_path_target_buf, target_checksum, OSTREE_OBJECT_TYPE_FILE,
|
_ostree_loose_path (loose_path_target_buf, target_checksum, OSTREE_OBJECT_TYPE_FILE,
|
||||||
|
@ -409,7 +409,8 @@ ostree_repo_static_delta_execute_offline_with_signature (OstreeRepo *self, GFile
|
|||||||
return glnx_throw_errno_prefix (error, "openat(O_DIRECTORY)");
|
return glnx_throw_errno_prefix (error, "openat(O_DIRECTORY)");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_autofree char *dir = dirname (g_strdup (dir_or_file_path));
|
g_autofree char *tmpbuf = g_strdup (dir_or_file_path);
|
||||||
|
const char *dir = dirname (tmpbuf);
|
||||||
basename = g_path_get_basename (dir_or_file_path);
|
basename = g_path_get_basename (dir_or_file_path);
|
||||||
|
|
||||||
if (!glnx_opendirat (AT_FDCWD, dir, TRUE, &dfd, error))
|
if (!glnx_opendirat (AT_FDCWD, dir, TRUE, &dfd, error))
|
||||||
|
@ -537,6 +537,7 @@ main (int argc, char *argv[])
|
|||||||
&etc_transient, &error))
|
&etc_transient, &error))
|
||||||
errx (EXIT_FAILURE, "Failed to parse etc.transient value: %s", error->message);
|
errx (EXIT_FAILURE, "Failed to parse etc.transient value: %s", error->message);
|
||||||
|
|
||||||
|
static const char *tmp_sysroot_etc = TMP_SYSROOT "/etc";
|
||||||
if (etc_transient)
|
if (etc_transient)
|
||||||
{
|
{
|
||||||
char *ovldir = "/run/ostree/transient-etc";
|
char *ovldir = "/run/ostree/transient-etc";
|
||||||
@ -564,15 +565,15 @@ main (int argc, char *argv[])
|
|||||||
|
|
||||||
g_autofree char *ovl_options
|
g_autofree char *ovl_options
|
||||||
= g_strdup_printf ("lowerdir=%s,upperdir=%s,workdir=%s", lowerdir, upperdir, workdir);
|
= g_strdup_printf ("lowerdir=%s,upperdir=%s,workdir=%s", lowerdir, upperdir, workdir);
|
||||||
if (mount ("overlay", TMP_SYSROOT "/etc", "overlay", MS_SILENT, ovl_options) < 0)
|
if (mount ("overlay", tmp_sysroot_etc, "overlay", MS_SILENT, ovl_options) < 0)
|
||||||
err (EXIT_FAILURE, "failed to mount transient etc overlayfs");
|
err (EXIT_FAILURE, "failed to mount transient etc overlayfs");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Bind-mount /etc (at deploy path), and remount as writable. */
|
/* Bind-mount /etc (at deploy path), and remount as writable. */
|
||||||
if (mount ("etc", TMP_SYSROOT "/etc", NULL, MS_BIND | MS_SILENT, NULL) < 0)
|
if (mount ("etc", tmp_sysroot_etc, NULL, MS_BIND | MS_SILENT, NULL) < 0)
|
||||||
err (EXIT_FAILURE, "failed to prepare /etc bind-mount at /sysroot.tmp/etc");
|
err (EXIT_FAILURE, "failed to prepare /etc bind-mount at /sysroot.tmp/etc");
|
||||||
if (mount (TMP_SYSROOT "/etc", TMP_SYSROOT "/etc", NULL, MS_BIND | MS_REMOUNT | MS_SILENT,
|
if (mount (tmp_sysroot_etc, tmp_sysroot_etc, NULL, MS_BIND | MS_REMOUNT | MS_SILENT,
|
||||||
NULL)
|
NULL)
|
||||||
< 0)
|
< 0)
|
||||||
err (EXIT_FAILURE, "failed to make writable /etc bind-mount at /sysroot.tmp/etc");
|
err (EXIT_FAILURE, "failed to make writable /etc bind-mount at /sysroot.tmp/etc");
|
||||||
|
Loading…
Reference in New Issue
Block a user