repo/commit: Change most of this file to new code style

I didn't touch everything since at least `commit_loose_object_trusted`
does this:

```
 out:
  if (G_UNLIKELY (error && *error))
    g_prefix_error (error, "Writing object %s.%s: ", checksum, ostree_object_type_to_string (objtype));
```

Which...it'd be interesting to make into an autocleanup. But for now just
keeping up with converting things bit by bit.

Closes: #761
Approved by: jlebon
This commit is contained in:
Colin Walters 2017-03-27 14:42:08 -04:00 committed by Atomic Bot
parent 5333a429ce
commit d994aee0a1
1 changed files with 130 additions and 237 deletions

View File

@ -144,7 +144,6 @@ _ostree_repo_commit_loose_final (OstreeRepo *self,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
gboolean ret = FALSE;
int dest_dfd; int dest_dfd;
char tmpbuf[_OSTREE_LOOSE_PATH_MAX]; char tmpbuf[_OSTREE_LOOSE_PATH_MAX];
@ -157,13 +156,13 @@ _ostree_repo_commit_loose_final (OstreeRepo *self,
if (!_ostree_repo_ensure_loose_objdir_at (dest_dfd, tmpbuf, if (!_ostree_repo_ensure_loose_objdir_at (dest_dfd, tmpbuf,
cancellable, error)) cancellable, error))
goto out; return FALSE;
if (fd != -1) if (fd != -1)
{ {
if (!glnx_link_tmpfile_at (temp_dfd, GLNX_LINK_TMPFILE_NOREPLACE_IGNORE_EXIST, if (!glnx_link_tmpfile_at (temp_dfd, GLNX_LINK_TMPFILE_NOREPLACE_IGNORE_EXIST,
fd, temp_filename, dest_dfd, tmpbuf, error)) fd, temp_filename, dest_dfd, tmpbuf, error))
goto out; return FALSE;
} }
else else
{ {
@ -171,19 +170,13 @@ _ostree_repo_commit_loose_final (OstreeRepo *self,
dest_dfd, tmpbuf) == -1)) dest_dfd, tmpbuf) == -1))
{ {
if (errno != EEXIST) if (errno != EEXIST)
{ return glnx_throw_errno_prefix (error, "Storing file '%s'", temp_filename);
glnx_set_error_from_errno (error);
g_prefix_error (error, "Storing file '%s': ", temp_filename);
goto out;
}
else else
(void) unlinkat (temp_dfd, temp_filename, 0); (void) unlinkat (temp_dfd, temp_filename, 0);
} }
} }
ret = TRUE; return TRUE;
out:
return ret;
} }
static gboolean static gboolean
@ -297,19 +290,13 @@ commit_loose_object_trusted (OstreeRepo *self,
checkout. To make this work we apply all user bits and the read bits for checkout. To make this work we apply all user bits and the read bits for
group/other. Furthermore, setting user xattrs requires write access, so group/other. Furthermore, setting user xattrs requires write access, so
this makes sure it's at least writable by us. (O_TMPFILE uses mode 0 by default) */ this makes sure it's at least writable by us. (O_TMPFILE uses mode 0 by default) */
do if (fchmod (fd, mode | 0744) < 0)
res = fchmod (fd, mode | 0744); return glnx_throw_errno (error);
while (G_UNLIKELY (res == -1 && errno == EINTR));
if (G_UNLIKELY (res == -1))
{
glnx_set_error_from_errno (error);
goto out;
}
} }
if (self->mode == OSTREE_REPO_MODE_BARE_USER && if (self->mode == OSTREE_REPO_MODE_BARE_USER &&
!write_file_metadata_to_xattr (fd, uid, gid, mode, xattrs, error)) !write_file_metadata_to_xattr (fd, uid, gid, mode, xattrs, error))
goto out; return FALSE;
} }
if (objtype == OSTREE_OBJECT_TYPE_FILE && _ostree_repo_mode_is_bare (self->mode)) if (objtype == OSTREE_OBJECT_TYPE_FILE && _ostree_repo_mode_is_bare (self->mode))
@ -1123,8 +1110,6 @@ ostree_repo_prepare_transaction (OstreeRepo *self,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
gboolean ret = FALSE;
gboolean ret_transaction_resume = FALSE;
g_return_val_if_fail (self->in_transaction == FALSE, FALSE); g_return_val_if_fail (self->in_transaction == FALSE, FALSE);
@ -1132,6 +1117,7 @@ ostree_repo_prepare_transaction (OstreeRepo *self,
self->in_transaction = TRUE; self->in_transaction = TRUE;
gboolean ret_transaction_resume = FALSE;
if (!_ostree_repo_allocate_tmpdir (self->tmp_dir_fd, if (!_ostree_repo_allocate_tmpdir (self->tmp_dir_fd,
self->stagedir_prefix, self->stagedir_prefix,
&self->commit_stagedir_name, &self->commit_stagedir_name,
@ -1139,13 +1125,11 @@ ostree_repo_prepare_transaction (OstreeRepo *self,
&self->commit_stagedir_lock, &self->commit_stagedir_lock,
&ret_transaction_resume, &ret_transaction_resume,
cancellable, error)) cancellable, error))
goto out; return FALSE;
ret = TRUE;
if (out_transaction_resume) if (out_transaction_resume)
*out_transaction_resume = ret_transaction_resume; *out_transaction_resume = ret_transaction_resume;
out: return TRUE;
return ret;
} }
static gboolean static gboolean
@ -1153,11 +1137,10 @@ rename_pending_loose_objects (OstreeRepo *self,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
gboolean ret = FALSE;
g_auto(GLnxDirFdIterator) dfd_iter = { 0, }; g_auto(GLnxDirFdIterator) dfd_iter = { 0, };
if (!glnx_dirfd_iterator_init_at (self->commit_stagedir_fd, ".", FALSE, &dfd_iter, error)) if (!glnx_dirfd_iterator_init_at (self->commit_stagedir_fd, ".", FALSE, &dfd_iter, error))
goto out; return FALSE;
/* Iterate over the outer checksum dir */ /* Iterate over the outer checksum dir */
while (TRUE) while (TRUE)
@ -1166,7 +1149,7 @@ rename_pending_loose_objects (OstreeRepo *self,
g_auto(GLnxDirFdIterator) child_dfd_iter = { 0, }; g_auto(GLnxDirFdIterator) child_dfd_iter = { 0, };
if (!glnx_dirfd_iterator_next_dent_ensure_dtype (&dfd_iter, &dent, cancellable, error)) if (!glnx_dirfd_iterator_next_dent_ensure_dtype (&dfd_iter, &dent, cancellable, error))
goto out; return FALSE;
if (dent == NULL) if (dent == NULL)
break; break;
@ -1179,7 +1162,7 @@ rename_pending_loose_objects (OstreeRepo *self,
if (!glnx_dirfd_iterator_init_at (dfd_iter.fd, dent->d_name, FALSE, if (!glnx_dirfd_iterator_init_at (dfd_iter.fd, dent->d_name, FALSE,
&child_dfd_iter, error)) &child_dfd_iter, error))
goto out; return FALSE;
/* Iterate over inner checksum dir */ /* Iterate over inner checksum dir */
while (TRUE) while (TRUE)
@ -1188,7 +1171,7 @@ rename_pending_loose_objects (OstreeRepo *self,
char loose_objpath[_OSTREE_LOOSE_PATH_MAX]; char loose_objpath[_OSTREE_LOOSE_PATH_MAX];
if (!glnx_dirfd_iterator_next_dent (&child_dfd_iter, &child_dent, cancellable, error)) if (!glnx_dirfd_iterator_next_dent (&child_dfd_iter, &child_dent, cancellable, error))
goto out; return FALSE;
if (child_dent == NULL) if (child_dent == NULL)
break; break;
@ -1200,24 +1183,19 @@ rename_pending_loose_objects (OstreeRepo *self,
if (!_ostree_repo_ensure_loose_objdir_at (self->objects_dir_fd, loose_objpath, if (!_ostree_repo_ensure_loose_objdir_at (self->objects_dir_fd, loose_objpath,
cancellable, error)) cancellable, error))
goto out; return FALSE;
if (G_UNLIKELY (renameat (child_dfd_iter.fd, loose_objpath + 3, if (G_UNLIKELY (renameat (child_dfd_iter.fd, loose_objpath + 3,
self->objects_dir_fd, loose_objpath) < 0)) self->objects_dir_fd, loose_objpath) < 0))
{ return glnx_throw_errno (error);
glnx_set_error_from_errno (error);
goto out;
}
} }
} }
if (!glnx_shutil_rm_rf_at (self->tmp_dir_fd, self->commit_stagedir_name, if (!glnx_shutil_rm_rf_at (self->tmp_dir_fd, self->commit_stagedir_name,
cancellable, error)) cancellable, error))
goto out; return FALSE;
ret = TRUE; return TRUE;
out:
return ret;
} }
static gboolean static gboolean
@ -1225,14 +1203,13 @@ cleanup_tmpdir (OstreeRepo *self,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
gboolean ret = FALSE;
g_auto(GLnxDirFdIterator) dfd_iter = { 0, }; g_auto(GLnxDirFdIterator) dfd_iter = { 0, };
guint64 curtime_secs; guint64 curtime_secs;
curtime_secs = g_get_real_time () / 1000000; curtime_secs = g_get_real_time () / 1000000;
if (!glnx_dirfd_iterator_init_at (self->tmp_dir_fd, ".", TRUE, &dfd_iter, error)) if (!glnx_dirfd_iterator_init_at (self->tmp_dir_fd, ".", TRUE, &dfd_iter, error))
goto out; return FALSE;
while (TRUE) while (TRUE)
{ {
@ -1243,7 +1220,7 @@ cleanup_tmpdir (OstreeRepo *self,
gboolean did_lock; gboolean did_lock;
if (!glnx_dirfd_iterator_next_dent (&dfd_iter, &dent, cancellable, error)) if (!glnx_dirfd_iterator_next_dent (&dfd_iter, &dent, cancellable, error))
goto out; return FALSE;
if (dent == NULL) if (dent == NULL)
break; break;
@ -1258,8 +1235,7 @@ cleanup_tmpdir (OstreeRepo *self,
{ {
if (errno == ENOENT) /* Did another cleanup win? */ if (errno == ENOENT) /* Did another cleanup win? */
continue; continue;
glnx_set_error_from_errno (error); return glnx_throw_errno (error);
goto out;
} }
/* First, if it's a directory which needs locking, but it's /* First, if it's a directory which needs locking, but it's
@ -1269,7 +1245,7 @@ cleanup_tmpdir (OstreeRepo *self,
{ {
if (!_ostree_repo_try_lock_tmpdir (dfd_iter.fd, dent->d_name, if (!_ostree_repo_try_lock_tmpdir (dfd_iter.fd, dent->d_name,
&lockfile, &did_lock, error)) &lockfile, &did_lock, error))
goto out; return FALSE;
if (!did_lock) if (!did_lock)
continue; continue;
} }
@ -1286,7 +1262,7 @@ cleanup_tmpdir (OstreeRepo *self,
* from *other* boots * from *other* boots
*/ */
if (!glnx_shutil_rm_rf_at (dfd_iter.fd, dent->d_name, cancellable, error)) if (!glnx_shutil_rm_rf_at (dfd_iter.fd, dent->d_name, cancellable, error))
goto out; return FALSE;
} }
/* FIXME - move OSTREE_REPO_TMPDIR_FETCHER underneath the /* FIXME - move OSTREE_REPO_TMPDIR_FETCHER underneath the
* staging/boot-id scheme as well, since all of the "did it get * staging/boot-id scheme as well, since all of the "did it get
@ -1311,14 +1287,12 @@ cleanup_tmpdir (OstreeRepo *self,
if (delta > self->tmp_expiry_seconds) if (delta > self->tmp_expiry_seconds)
{ {
if (!glnx_shutil_rm_rf_at (dfd_iter.fd, dent->d_name, cancellable, error)) if (!glnx_shutil_rm_rf_at (dfd_iter.fd, dent->d_name, cancellable, error))
goto out; return FALSE;
} }
} }
} }
ret = TRUE; return TRUE;
out:
return ret;
} }
static void static void
@ -1432,16 +1406,10 @@ ostree_repo_commit_transaction (OstreeRepo *self,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
gboolean ret = FALSE;
g_return_val_if_fail (self->in_transaction == TRUE, FALSE); g_return_val_if_fail (self->in_transaction == TRUE, FALSE);
if ((self->test_error_flags & OSTREE_REPO_TEST_ERROR_PRE_COMMIT) > 0) if ((self->test_error_flags & OSTREE_REPO_TEST_ERROR_PRE_COMMIT) > 0)
{ return glnx_throw (error, "OSTREE_REPO_TEST_ERROR_PRE_COMMIT specified");
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"OSTREE_REPO_TEST_ERROR_PRE_COMMIT specified");
goto out;
}
/* FIXME: Added since valgrind in el7 doesn't know about /* FIXME: Added since valgrind in el7 doesn't know about
* `syncfs`...we should delete this later. * `syncfs`...we should delete this later.
@ -1449,24 +1417,21 @@ ostree_repo_commit_transaction (OstreeRepo *self,
if (g_getenv ("OSTREE_SUPPRESS_SYNCFS") == NULL) if (g_getenv ("OSTREE_SUPPRESS_SYNCFS") == NULL)
{ {
if (syncfs (self->tmp_dir_fd) < 0) if (syncfs (self->tmp_dir_fd) < 0)
{ return glnx_throw_errno (error);
glnx_set_error_from_errno (error);
goto out;
}
} }
if (!rename_pending_loose_objects (self, cancellable, error)) if (!rename_pending_loose_objects (self, cancellable, error))
goto out; return FALSE;
if (!cleanup_tmpdir (self, cancellable, error)) if (!cleanup_tmpdir (self, cancellable, error))
goto out; return FALSE;
if (self->loose_object_devino_hash) if (self->loose_object_devino_hash)
g_hash_table_remove_all (self->loose_object_devino_hash); g_hash_table_remove_all (self->loose_object_devino_hash);
if (self->txn_refs) if (self->txn_refs)
if (!_ostree_repo_update_refs (self, self->txn_refs, cancellable, error)) if (!_ostree_repo_update_refs (self, self->txn_refs, cancellable, error))
goto out; return FALSE;
g_clear_pointer (&self->txn_refs, g_hash_table_destroy); g_clear_pointer (&self->txn_refs, g_hash_table_destroy);
if (self->commit_stagedir_fd != -1) if (self->commit_stagedir_fd != -1)
@ -1482,14 +1447,12 @@ ostree_repo_commit_transaction (OstreeRepo *self,
self->in_transaction = FALSE; self->in_transaction = FALSE;
if (!ot_ensure_unlinked_at (self->repo_dir_fd, "transaction", 0)) if (!ot_ensure_unlinked_at (self->repo_dir_fd, "transaction", 0))
goto out; return FALSE;
if (out_stats) if (out_stats)
*out_stats = self->txn_stats; *out_stats = self->txn_stats;
ret = TRUE; return TRUE;
out:
return ret;
} }
gboolean gboolean
@ -1497,13 +1460,12 @@ ostree_repo_abort_transaction (OstreeRepo *self,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
gboolean ret = FALSE; /* Note early return */
if (!self->in_transaction) if (!self->in_transaction)
return TRUE; return TRUE;
if (!cleanup_tmpdir (self, cancellable, error)) if (!cleanup_tmpdir (self, cancellable, error))
goto out; return FALSE;
if (self->loose_object_devino_hash) if (self->loose_object_devino_hash)
g_hash_table_remove_all (self->loose_object_devino_hash); g_hash_table_remove_all (self->loose_object_devino_hash);
@ -1521,9 +1483,7 @@ ostree_repo_abort_transaction (OstreeRepo *self,
self->in_transaction = FALSE; self->in_transaction = FALSE;
ret = TRUE; return TRUE;
out:
return ret;
} }
/** /**
@ -1551,8 +1511,6 @@ ostree_repo_write_metadata (OstreeRepo *self,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
gboolean ret = FALSE;
g_autoptr(GInputStream) input = NULL;
g_autoptr(GVariant) normalized = NULL; g_autoptr(GVariant) normalized = NULL;
normalized = g_variant_get_normal_form (object); normalized = g_variant_get_normal_form (object);
@ -1561,25 +1519,19 @@ ostree_repo_write_metadata (OstreeRepo *self,
{ {
g_autofree char *input_bytes = g_format_size (g_variant_get_size (normalized)); g_autofree char *input_bytes = g_format_size (g_variant_get_size (normalized));
g_autofree char *max_bytes = g_format_size (OSTREE_MAX_METADATA_SIZE); g_autofree char *max_bytes = g_format_size (OSTREE_MAX_METADATA_SIZE);
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, return glnx_throw (error, "Metadata object of type '%s' is %s; maximum metadata size is %s",
"Metadata object of type '%s' is %s; maximum metadata size is %s", ostree_object_type_to_string (objtype), input_bytes, max_bytes);
ostree_object_type_to_string (objtype),
input_bytes,
max_bytes);
goto out;
} }
input = ot_variant_read (normalized); g_autoptr(GInputStream) input = ot_variant_read (normalized);
if (!write_object (self, objtype, expected_checksum, if (!write_object (self, objtype, expected_checksum,
input, g_variant_get_size (normalized), input, g_variant_get_size (normalized),
out_csum, out_csum,
cancellable, error)) cancellable, error))
goto out; return FALSE;
ret = TRUE; return TRUE;
out:
return ret;
} }
/** /**
@ -2006,38 +1958,33 @@ ostree_repo_write_commit_with_time (OstreeRepo *self,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
gboolean ret = FALSE;
g_autofree char *ret_commit = NULL;
g_autoptr(GVariant) commit = NULL;
g_autoptr(GVariant) new_metadata = NULL;
g_autofree guchar *commit_csum = NULL;
OstreeRepoFile *repo_root = OSTREE_REPO_FILE (root); OstreeRepoFile *repo_root = OSTREE_REPO_FILE (root);
/* Add sizes information to our metadata object */ /* Add sizes information to our metadata object */
g_autoptr(GVariant) new_metadata = NULL;
if (!add_size_index_to_metadata (self, metadata, &new_metadata, if (!add_size_index_to_metadata (self, metadata, &new_metadata,
cancellable, error)) cancellable, error))
goto out; return FALSE;
commit = g_variant_new ("(@a{sv}@ay@a(say)sst@ay@ay)", g_autoptr(GVariant) commit =
new_metadata ? new_metadata : create_empty_gvariant_dict (), g_variant_new ("(@a{sv}@ay@a(say)sst@ay@ay)",
parent ? ostree_checksum_to_bytes_v (parent) : ot_gvariant_new_bytearray (NULL, 0), new_metadata ? new_metadata : create_empty_gvariant_dict (),
g_variant_new_array (G_VARIANT_TYPE ("(say)"), NULL, 0), parent ? ostree_checksum_to_bytes_v (parent) : ot_gvariant_new_bytearray (NULL, 0),
subject ? subject : "", body ? body : "", g_variant_new_array (G_VARIANT_TYPE ("(say)"), NULL, 0),
GUINT64_TO_BE (time), subject ? subject : "", body ? body : "",
ostree_checksum_to_bytes_v (ostree_repo_file_tree_get_contents_checksum (repo_root)), GUINT64_TO_BE (time),
ostree_checksum_to_bytes_v (ostree_repo_file_tree_get_metadata_checksum (repo_root))); ostree_checksum_to_bytes_v (ostree_repo_file_tree_get_contents_checksum (repo_root)),
ostree_checksum_to_bytes_v (ostree_repo_file_tree_get_metadata_checksum (repo_root)));
g_variant_ref_sink (commit); g_variant_ref_sink (commit);
g_autofree guchar *commit_csum = NULL;
if (!ostree_repo_write_metadata (self, OSTREE_OBJECT_TYPE_COMMIT, NULL, if (!ostree_repo_write_metadata (self, OSTREE_OBJECT_TYPE_COMMIT, NULL,
commit, &commit_csum, commit, &commit_csum,
cancellable, error)) cancellable, error))
goto out; return FALSE;
ret_commit = ostree_checksum_from_bytes (commit_csum); g_autofree char *ret_commit = ostree_checksum_from_bytes (commit_csum);
ret = TRUE;
ot_transfer_out_value(out_commit, &ret_commit); ot_transfer_out_value(out_commit, &ret_commit);
out: return TRUE;
return ret;
} }
/** /**
@ -2059,29 +2006,21 @@ ostree_repo_read_commit_detached_metadata (OstreeRepo *self,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
gboolean ret = FALSE;
char buf[_OSTREE_LOOSE_PATH_MAX]; char buf[_OSTREE_LOOSE_PATH_MAX];
g_autoptr(GVariant) ret_metadata = NULL;
_ostree_loose_path (buf, checksum, OSTREE_OBJECT_TYPE_COMMIT_META, self->mode); _ostree_loose_path (buf, checksum, OSTREE_OBJECT_TYPE_COMMIT_META, self->mode);
g_autoptr(GVariant) ret_metadata = NULL;
if (self->commit_stagedir_fd != -1 && if (self->commit_stagedir_fd != -1 &&
!ot_util_variant_map_at (self->commit_stagedir_fd, buf, !ot_util_variant_map_at (self->commit_stagedir_fd, buf,
G_VARIANT_TYPE ("a{sv}"), G_VARIANT_TYPE ("a{sv}"),
OT_VARIANT_MAP_ALLOW_NOENT | OT_VARIANT_MAP_TRUSTED, &ret_metadata, error)) OT_VARIANT_MAP_ALLOW_NOENT | OT_VARIANT_MAP_TRUSTED, &ret_metadata, error))
{ return g_prefix_error (error, "Unable to read existing detached metadata: "), FALSE;
g_prefix_error (error, "Unable to read existing detached metadata: ");
goto out;
}
if (ret_metadata == NULL && if (ret_metadata == NULL &&
!ot_util_variant_map_at (self->objects_dir_fd, buf, !ot_util_variant_map_at (self->objects_dir_fd, buf,
G_VARIANT_TYPE ("a{sv}"), G_VARIANT_TYPE ("a{sv}"),
OT_VARIANT_MAP_ALLOW_NOENT | OT_VARIANT_MAP_TRUSTED, &ret_metadata, error)) OT_VARIANT_MAP_ALLOW_NOENT | OT_VARIANT_MAP_TRUSTED, &ret_metadata, error))
{ return g_prefix_error (error, "Unable to read existing detached metadata: "), FALSE;
g_prefix_error (error, "Unable to read existing detached metadata: ");
goto out;
}
if (ret_metadata == NULL && self->parent_repo) if (ret_metadata == NULL && self->parent_repo)
return ostree_repo_read_commit_detached_metadata (self->parent_repo, return ostree_repo_read_commit_detached_metadata (self->parent_repo,
@ -2089,10 +2028,8 @@ ostree_repo_read_commit_detached_metadata (OstreeRepo *self,
out_metadata, out_metadata,
cancellable, cancellable,
error); error);
ret = TRUE;
ot_transfer_out_value (out_metadata, &ret_metadata); ot_transfer_out_value (out_metadata, &ret_metadata);
out: return TRUE;
return ret;
} }
/** /**
@ -2322,7 +2259,6 @@ get_modified_xattrs (OstreeRepo *self,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
gboolean ret = FALSE;
g_autoptr(GVariant) ret_xattrs = NULL; g_autoptr(GVariant) ret_xattrs = NULL;
if (modifier && modifier->xattr_callback) if (modifier && modifier->xattr_callback)
@ -2340,27 +2276,27 @@ get_modified_xattrs (OstreeRepo *self,
&ret_xattrs, &ret_xattrs,
cancellable, cancellable,
error)) error))
goto out; return FALSE;
} }
else if (path) else if (path)
{ {
if (!glnx_dfd_name_get_all_xattrs (AT_FDCWD, gs_file_get_path_cached (path), if (!glnx_dfd_name_get_all_xattrs (AT_FDCWD, gs_file_get_path_cached (path),
&ret_xattrs, cancellable, error)) &ret_xattrs, cancellable, error))
goto out; return FALSE;
} }
else if (dfd_subpath == NULL) else if (dfd_subpath == NULL)
{ {
g_assert (dfd != -1); g_assert (dfd != -1);
if (!glnx_fd_get_all_xattrs (dfd, &ret_xattrs, if (!glnx_fd_get_all_xattrs (dfd, &ret_xattrs,
cancellable, error)) cancellable, error))
goto out; return FALSE;
} }
else else
{ {
g_assert (dfd != -1); g_assert (dfd != -1);
if (!glnx_dfd_name_get_all_xattrs (dfd, dfd_subpath, &ret_xattrs, if (!glnx_dfd_name_get_all_xattrs (dfd, dfd_subpath, &ret_xattrs,
cancellable, error)) cancellable, error))
goto out; return FALSE;
} }
} }
@ -2371,7 +2307,7 @@ get_modified_xattrs (OstreeRepo *self,
if (!ostree_sepolicy_get_label (modifier->sepolicy, relpath, if (!ostree_sepolicy_get_label (modifier->sepolicy, relpath,
g_file_info_get_attribute_uint32 (file_info, "unix::mode"), g_file_info_get_attribute_uint32 (file_info, "unix::mode"),
&label, cancellable, error)) &label, cancellable, error))
goto out; return FALSE;
if (label) if (label)
{ {
@ -2392,12 +2328,10 @@ get_modified_xattrs (OstreeRepo *self,
g_variant_ref_sink (ret_xattrs); g_variant_ref_sink (ret_xattrs);
} }
} }
ret = TRUE;
if (out_xattrs) if (out_xattrs)
*out_xattrs = g_steal_pointer (&ret_xattrs); *out_xattrs = g_steal_pointer (&ret_xattrs);
out: return TRUE;
return ret;
} }
static gboolean static gboolean
@ -2429,7 +2363,6 @@ write_directory_content_to_mtree_internal (OstreeRepo *self,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
gboolean ret = FALSE;
g_autoptr(GFile) child = NULL; g_autoptr(GFile) child = NULL;
g_autoptr(GFileInfo) modified_info = NULL; g_autoptr(GFileInfo) modified_info = NULL;
glnx_unref_object OstreeMutableTree *child_mtree = NULL; glnx_unref_object OstreeMutableTree *child_mtree = NULL;
@ -2451,8 +2384,8 @@ write_directory_content_to_mtree_internal (OstreeRepo *self,
if (filter_result != OSTREE_REPO_COMMIT_FILTER_ALLOW) if (filter_result != OSTREE_REPO_COMMIT_FILTER_ALLOW)
{ {
g_ptr_array_remove_index (path, path->len - 1); g_ptr_array_remove_index (path, path->len - 1);
ret = TRUE; /* Note: early return */
goto out; return TRUE;
} }
file_type = g_file_info_get_file_type (child_info); file_type = g_file_info_get_file_type (child_info);
@ -2463,10 +2396,8 @@ write_directory_content_to_mtree_internal (OstreeRepo *self,
case G_FILE_TYPE_REGULAR: case G_FILE_TYPE_REGULAR:
break; break;
default: default:
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, return glnx_throw (error, "Unsupported file type: '%s'",
"Unsupported file type: '%s'", gs_file_get_path_cached (child));
gs_file_get_path_cached (child));
goto out;
} }
if (dir_enum != NULL) if (dir_enum != NULL)
@ -2475,26 +2406,26 @@ write_directory_content_to_mtree_internal (OstreeRepo *self,
if (file_type == G_FILE_TYPE_DIRECTORY) if (file_type == G_FILE_TYPE_DIRECTORY)
{ {
if (!ostree_mutable_tree_ensure_dir (mtree, name, &child_mtree, error)) if (!ostree_mutable_tree_ensure_dir (mtree, name, &child_mtree, error))
goto out; return FALSE;
if (dir_enum != NULL) if (dir_enum != NULL)
{ {
if (!write_directory_to_mtree_internal (self, child, child_mtree, if (!write_directory_to_mtree_internal (self, child, child_mtree,
modifier, path, modifier, path,
cancellable, error)) cancellable, error))
goto out; return FALSE;
} }
else else
{ {
g_auto(GLnxDirFdIterator) child_dfd_iter = { 0, }; g_auto(GLnxDirFdIterator) child_dfd_iter = { 0, };
if (!glnx_dirfd_iterator_init_at (dfd_iter->fd, name, FALSE, &child_dfd_iter, error)) if (!glnx_dirfd_iterator_init_at (dfd_iter->fd, name, FALSE, &child_dfd_iter, error))
goto out; return FALSE;
if (!write_dfd_iter_to_mtree_internal (self, &child_dfd_iter, child_mtree, if (!write_dfd_iter_to_mtree_internal (self, &child_dfd_iter, child_mtree,
modifier, path, modifier, path,
cancellable, error)) cancellable, error))
goto out; return FALSE;
} }
} }
else if (repo_dir) else if (repo_dir)
@ -2504,7 +2435,7 @@ write_directory_content_to_mtree_internal (OstreeRepo *self,
if (!ostree_mutable_tree_replace_file (mtree, name, if (!ostree_mutable_tree_replace_file (mtree, name,
ostree_repo_file_get_checksum ((OstreeRepoFile*) child), ostree_repo_file_get_checksum ((OstreeRepoFile*) child),
error)) error))
goto out; return FALSE;
} }
else else
{ {
@ -2524,7 +2455,7 @@ write_directory_content_to_mtree_internal (OstreeRepo *self,
{ {
if (!ostree_mutable_tree_replace_file (mtree, name, loose_checksum, if (!ostree_mutable_tree_replace_file (mtree, name, loose_checksum,
error)) error))
goto out; return FALSE;
} }
else else
{ {
@ -2534,13 +2465,13 @@ write_directory_content_to_mtree_internal (OstreeRepo *self,
{ {
file_input = (GInputStream*)g_file_read (child, cancellable, error); file_input = (GInputStream*)g_file_read (child, cancellable, error);
if (!file_input) if (!file_input)
goto out; return FALSE;
} }
else else
{ {
if (!ot_openat_read_stream (dfd_iter->fd, name, FALSE, if (!ot_openat_read_stream (dfd_iter->fd, name, FALSE,
&file_input, cancellable, error)) &file_input, cancellable, error))
goto out; return FALSE;
} }
} }
@ -2548,30 +2479,28 @@ write_directory_content_to_mtree_internal (OstreeRepo *self,
child_relpath, child_info, child, dfd_iter != NULL ? dfd_iter->fd : -1, name, child_relpath, child_info, child, dfd_iter != NULL ? dfd_iter->fd : -1, name,
&xattrs, &xattrs,
cancellable, error)) cancellable, error))
goto out; return FALSE;
if (!ostree_raw_file_to_content_stream (file_input, if (!ostree_raw_file_to_content_stream (file_input,
modified_info, xattrs, modified_info, xattrs,
&file_object_input, &file_obj_length, &file_object_input, &file_obj_length,
cancellable, error)) cancellable, error))
goto out; return FALSE;
if (!ostree_repo_write_content (self, NULL, file_object_input, file_obj_length, if (!ostree_repo_write_content (self, NULL, file_object_input, file_obj_length,
&child_file_csum, cancellable, error)) &child_file_csum, cancellable, error))
goto out; return FALSE;
g_free (tmp_checksum); g_free (tmp_checksum);
tmp_checksum = ostree_checksum_from_bytes (child_file_csum); tmp_checksum = ostree_checksum_from_bytes (child_file_csum);
if (!ostree_mutable_tree_replace_file (mtree, name, tmp_checksum, if (!ostree_mutable_tree_replace_file (mtree, name, tmp_checksum,
error)) error))
goto out; return FALSE;
} }
} }
g_ptr_array_remove_index (path, path->len - 1); g_ptr_array_remove_index (path, path->len - 1);
ret = TRUE; return TRUE;
out:
return ret;
} }
static gboolean static gboolean
@ -2583,10 +2512,8 @@ write_directory_to_mtree_internal (OstreeRepo *self,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
gboolean ret = FALSE;
OstreeRepoCommitFilterResult filter_result; OstreeRepoCommitFilterResult filter_result;
OstreeRepoFile *repo_dir = NULL; OstreeRepoFile *repo_dir = NULL;
g_autoptr(GFileInfo) child_info = NULL;
if (dir) if (dir)
g_debug ("Examining: %s", gs_file_get_path_cached (dir)); g_debug ("Examining: %s", gs_file_get_path_cached (dir));
@ -2599,7 +2526,7 @@ write_directory_to_mtree_internal (OstreeRepo *self,
if (repo_dir) if (repo_dir)
{ {
if (!ostree_repo_file_ensure_resolved (repo_dir, error)) if (!ostree_repo_file_ensure_resolved (repo_dir, error))
goto out; return FALSE;
ostree_mutable_tree_set_metadata_checksum (mtree, ostree_repo_file_tree_get_metadata_checksum (repo_dir)); ostree_mutable_tree_set_metadata_checksum (mtree, ostree_repo_file_tree_get_metadata_checksum (repo_dir));
@ -2607,21 +2534,20 @@ write_directory_to_mtree_internal (OstreeRepo *self,
} }
else else
{ {
g_autoptr(GFileInfo) modified_info = NULL;
g_autoptr(GVariant) xattrs = NULL; g_autoptr(GVariant) xattrs = NULL;
g_autofree guchar *child_file_csum = NULL;
g_autofree char *tmp_checksum = NULL;
g_autofree char *relpath = NULL;
child_info = g_file_query_info (dir, OSTREE_GIO_FAST_QUERYINFO, g_autoptr(GFileInfo) child_info =
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, g_file_query_info (dir, OSTREE_GIO_FAST_QUERYINFO,
cancellable, error); G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
cancellable, error);
if (!child_info) if (!child_info)
goto out; return FALSE;
g_autofree char *relpath = NULL;
if (modifier != NULL) if (modifier != NULL)
relpath = ptrarray_path_join (path); relpath = ptrarray_path_join (path);
g_autoptr(GFileInfo) modified_info = NULL;
filter_result = apply_commit_filter (self, modifier, relpath, child_info, &modified_info); filter_result = apply_commit_filter (self, modifier, relpath, child_info, &modified_info);
if (filter_result == OSTREE_REPO_COMMIT_FILTER_ALLOW) if (filter_result == OSTREE_REPO_COMMIT_FILTER_ALLOW)
@ -2630,18 +2556,16 @@ write_directory_to_mtree_internal (OstreeRepo *self,
dir, -1, NULL, dir, -1, NULL,
&xattrs, &xattrs,
cancellable, error)) cancellable, error))
goto out; return FALSE;
g_autofree guchar *child_file_csum = NULL;
if (!_ostree_repo_write_directory_meta (self, modified_info, xattrs, &child_file_csum, if (!_ostree_repo_write_directory_meta (self, modified_info, xattrs, &child_file_csum,
cancellable, error)) cancellable, error))
goto out; return FALSE;
g_free (tmp_checksum); g_autofree char *tmp_checksum = ostree_checksum_from_bytes (child_file_csum);
tmp_checksum = ostree_checksum_from_bytes (child_file_csum);
ostree_mutable_tree_set_metadata_checksum (mtree, tmp_checksum); ostree_mutable_tree_set_metadata_checksum (mtree, tmp_checksum);
} }
g_clear_object (&child_info);
} }
if (filter_result == OSTREE_REPO_COMMIT_FILTER_ALLOW) if (filter_result == OSTREE_REPO_COMMIT_FILTER_ALLOW)
@ -2653,15 +2577,15 @@ write_directory_to_mtree_internal (OstreeRepo *self,
cancellable, cancellable,
error); error);
if (!dir_enum) if (!dir_enum)
goto out; return FALSE;
while (TRUE) while (TRUE)
{ {
GFileInfo *child_info; GFileInfo *child_info;
if (!g_file_enumerator_iterate (dir_enum, &child_info, NULL, if (!g_file_enumerator_iterate (dir_enum, &child_info, NULL,
cancellable, error)) cancellable, error))
goto out; return FALSE;
if (child_info == NULL) if (child_info == NULL)
break; break;
@ -2669,13 +2593,11 @@ write_directory_to_mtree_internal (OstreeRepo *self,
child_info, child_info,
mtree, modifier, path, mtree, modifier, path,
cancellable, error)) cancellable, error))
goto out; return FALSE;
} }
} }
ret = TRUE; return TRUE;
out:
return ret;
} }
static gboolean static gboolean
@ -2687,7 +2609,6 @@ write_dfd_iter_to_mtree_internal (OstreeRepo *self,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
gboolean ret = FALSE;
g_autoptr(GFileInfo) child_info = NULL; g_autoptr(GFileInfo) child_info = NULL;
g_autoptr(GFileInfo) modified_info = NULL; g_autoptr(GFileInfo) modified_info = NULL;
g_autoptr(GVariant) xattrs = NULL; g_autoptr(GVariant) xattrs = NULL;
@ -2698,17 +2619,14 @@ write_dfd_iter_to_mtree_internal (OstreeRepo *self,
struct stat dir_stbuf; struct stat dir_stbuf;
if (fstat (src_dfd_iter->fd, &dir_stbuf) != 0) if (fstat (src_dfd_iter->fd, &dir_stbuf) != 0)
{ return glnx_throw_errno (error);
glnx_set_error_from_errno (error);
goto out;
}
child_info = _ostree_header_gfile_info_new (dir_stbuf.st_mode, dir_stbuf.st_uid, dir_stbuf.st_gid); child_info = _ostree_header_gfile_info_new (dir_stbuf.st_mode, dir_stbuf.st_uid, dir_stbuf.st_gid);
if (modifier != NULL) if (modifier != NULL)
{ {
relpath = ptrarray_path_join (path); relpath = ptrarray_path_join (path);
filter_result = apply_commit_filter (self, modifier, relpath, child_info, &modified_info); filter_result = apply_commit_filter (self, modifier, relpath, child_info, &modified_info);
} }
else else
@ -2723,11 +2641,11 @@ write_dfd_iter_to_mtree_internal (OstreeRepo *self,
NULL, src_dfd_iter->fd, NULL, NULL, src_dfd_iter->fd, NULL,
&xattrs, &xattrs,
cancellable, error)) cancellable, error))
goto out; return FALSE;
if (!_ostree_repo_write_directory_meta (self, modified_info, xattrs, &child_file_csum, if (!_ostree_repo_write_directory_meta (self, modified_info, xattrs, &child_file_csum,
cancellable, error)) cancellable, error))
goto out; return FALSE;
g_free (tmp_checksum); g_free (tmp_checksum);
tmp_checksum = ostree_checksum_from_bytes (child_file_csum); tmp_checksum = ostree_checksum_from_bytes (child_file_csum);
@ -2736,8 +2654,8 @@ write_dfd_iter_to_mtree_internal (OstreeRepo *self,
if (filter_result != OSTREE_REPO_COMMIT_FILTER_ALLOW) if (filter_result != OSTREE_REPO_COMMIT_FILTER_ALLOW)
{ {
ret = TRUE; /* Note - early return */
goto out; return TRUE;
} }
while (TRUE) while (TRUE)
@ -2746,24 +2664,20 @@ write_dfd_iter_to_mtree_internal (OstreeRepo *self,
struct stat stbuf; struct stat stbuf;
g_autoptr(GFileInfo) child_info = NULL; g_autoptr(GFileInfo) child_info = NULL;
const char *loose_checksum; const char *loose_checksum;
if (!glnx_dirfd_iterator_next_dent (src_dfd_iter, &dent, cancellable, error)) if (!glnx_dirfd_iterator_next_dent (src_dfd_iter, &dent, cancellable, error))
goto out; return FALSE;
if (dent == NULL) if (dent == NULL)
break; break;
if (fstatat (src_dfd_iter->fd, dent->d_name, &stbuf, AT_SYMLINK_NOFOLLOW) == -1) if (fstatat (src_dfd_iter->fd, dent->d_name, &stbuf, AT_SYMLINK_NOFOLLOW) == -1)
{ return glnx_throw_errno (error);
glnx_set_error_from_errno (error);
goto out;
}
loose_checksum = devino_cache_lookup (self, modifier, stbuf.st_dev, stbuf.st_ino); loose_checksum = devino_cache_lookup (self, modifier, stbuf.st_dev, stbuf.st_ino);
if (loose_checksum) if (loose_checksum)
{ {
if (!ostree_mutable_tree_replace_file (mtree, dent->d_name, loose_checksum, if (!ostree_mutable_tree_replace_file (mtree, dent->d_name, loose_checksum,
error)) error))
goto out; return FALSE;
continue; continue;
} }
@ -2779,28 +2693,24 @@ write_dfd_iter_to_mtree_internal (OstreeRepo *self,
{ {
if (!ot_readlinkat_gfile_info (src_dfd_iter->fd, dent->d_name, if (!ot_readlinkat_gfile_info (src_dfd_iter->fd, dent->d_name,
child_info, cancellable, error)) child_info, cancellable, error))
goto out; return FALSE;
} }
else if (S_ISDIR (stbuf.st_mode)) else if (S_ISDIR (stbuf.st_mode))
; ;
else else
{ {
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, return glnx_throw (error, "Not a regular file or symlink: %s",
"Not a regular file or symlink: %s", dent->d_name);
dent->d_name);
goto out;
} }
if (!write_directory_content_to_mtree_internal (self, NULL, NULL, src_dfd_iter, if (!write_directory_content_to_mtree_internal (self, NULL, NULL, src_dfd_iter,
child_info, child_info,
mtree, modifier, path, mtree, modifier, path,
cancellable, error)) cancellable, error))
goto out; return FALSE;
} }
ret = TRUE; return TRUE;
out:
return ret;
} }
/** /**
@ -2823,30 +2733,26 @@ ostree_repo_write_directory_to_mtree (OstreeRepo *self,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
gboolean ret = FALSE;
g_autoptr(GPtrArray) path = NULL;
/* Short cut local files */ /* Short cut local files */
if (g_file_is_native (dir)) if (g_file_is_native (dir))
{ {
if (!ostree_repo_write_dfd_to_mtree (self, AT_FDCWD, gs_file_get_path_cached (dir), if (!ostree_repo_write_dfd_to_mtree (self, AT_FDCWD, gs_file_get_path_cached (dir),
mtree, modifier, cancellable, error)) mtree, modifier, cancellable, error))
goto out; return FALSE;
} }
else else
{ {
if (modifier && modifier->flags & OSTREE_REPO_COMMIT_MODIFIER_FLAGS_GENERATE_SIZES) if (modifier && modifier->flags & OSTREE_REPO_COMMIT_MODIFIER_FLAGS_GENERATE_SIZES)
self->generate_sizes = TRUE; self->generate_sizes = TRUE;
path = g_ptr_array_new (); g_autoptr(GPtrArray) path = g_ptr_array_new ();
if (!write_directory_to_mtree_internal (self, dir, mtree, modifier, path, if (!write_directory_to_mtree_internal (self, dir, mtree, modifier, path,
cancellable, error)) cancellable, error))
goto out; return FALSE;
} }
ret = TRUE; return TRUE;
out:
return ret;
} }
/** /**
@ -2872,25 +2778,19 @@ ostree_repo_write_dfd_to_mtree (OstreeRepo *self,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
gboolean ret = FALSE;
g_autoptr(GPtrArray) pathbuilder = NULL;
g_auto(GLnxDirFdIterator) dfd_iter = { 0, };
if (modifier && modifier->flags & OSTREE_REPO_COMMIT_MODIFIER_FLAGS_GENERATE_SIZES) if (modifier && modifier->flags & OSTREE_REPO_COMMIT_MODIFIER_FLAGS_GENERATE_SIZES)
self->generate_sizes = TRUE; self->generate_sizes = TRUE;
pathbuilder = g_ptr_array_new (); g_auto(GLnxDirFdIterator) dfd_iter = { 0, };
if (!glnx_dirfd_iterator_init_at (dfd, path, FALSE, &dfd_iter, error)) if (!glnx_dirfd_iterator_init_at (dfd, path, FALSE, &dfd_iter, error))
goto out; return FALSE;
g_autoptr(GPtrArray) pathbuilder = g_ptr_array_new ();
if (!write_dfd_iter_to_mtree_internal (self, &dfd_iter, mtree, modifier, pathbuilder, if (!write_dfd_iter_to_mtree_internal (self, &dfd_iter, mtree, modifier, pathbuilder,
cancellable, error)) cancellable, error))
goto out; return FALSE;
ret = TRUE; return TRUE;
out:
return ret;
} }
/** /**
@ -2912,19 +2812,12 @@ ostree_repo_write_mtree (OstreeRepo *self,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
gboolean ret = FALSE;
GHashTableIter hash_iter;
gpointer key, value;
const char *contents_checksum, *metadata_checksum; const char *contents_checksum, *metadata_checksum;
g_autoptr(GFile) ret_file = NULL; g_autoptr(GFile) ret_file = NULL;
metadata_checksum = ostree_mutable_tree_get_metadata_checksum (mtree); metadata_checksum = ostree_mutable_tree_get_metadata_checksum (mtree);
if (!metadata_checksum) if (!metadata_checksum)
{ return glnx_throw (error, "Can't commit an empty tree");
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Can't commit an empty tree");
goto out;
}
contents_checksum = ostree_mutable_tree_get_contents_checksum (mtree); contents_checksum = ostree_mutable_tree_get_contents_checksum (mtree);
if (contents_checksum) if (contents_checksum)
@ -2944,6 +2837,8 @@ ostree_repo_write_mtree (OstreeRepo *self,
dir_metadata_checksums = g_hash_table_new_full (g_str_hash, g_str_equal, dir_metadata_checksums = g_hash_table_new_full (g_str_hash, g_str_equal,
(GDestroyNotify)g_free, (GDestroyNotify)g_free); (GDestroyNotify)g_free, (GDestroyNotify)g_free);
GHashTableIter hash_iter;
gpointer key, value;
g_hash_table_iter_init (&hash_iter, ostree_mutable_tree_get_subdirs (mtree)); g_hash_table_iter_init (&hash_iter, ostree_mutable_tree_get_subdirs (mtree));
while (g_hash_table_iter_next (&hash_iter, &key, &value)) while (g_hash_table_iter_next (&hash_iter, &key, &value))
{ {
@ -2953,7 +2848,7 @@ ostree_repo_write_mtree (OstreeRepo *self,
if (!ostree_repo_write_mtree (self, child_dir, &child_file, if (!ostree_repo_write_mtree (self, child_dir, &child_file,
cancellable, error)) cancellable, error))
goto out; return FALSE;
g_hash_table_replace (dir_contents_checksums, g_strdup (name), g_hash_table_replace (dir_contents_checksums, g_strdup (name),
g_strdup (ostree_repo_file_tree_get_contents_checksum (OSTREE_REPO_FILE (child_file)))); g_strdup (ostree_repo_file_tree_get_contents_checksum (OSTREE_REPO_FILE (child_file))));
@ -2968,7 +2863,7 @@ ostree_repo_write_mtree (OstreeRepo *self,
if (!ostree_repo_write_metadata (self, OSTREE_OBJECT_TYPE_DIR_TREE, NULL, if (!ostree_repo_write_metadata (self, OSTREE_OBJECT_TYPE_DIR_TREE, NULL,
serialized_tree, &contents_csum, serialized_tree, &contents_csum,
cancellable, error)) cancellable, error))
goto out; return FALSE;
ostree_checksum_inplace_from_bytes (contents_csum, contents_checksum_buf); ostree_checksum_inplace_from_bytes (contents_csum, contents_checksum_buf);
ostree_mutable_tree_set_contents_checksum (mtree, contents_checksum_buf); ostree_mutable_tree_set_contents_checksum (mtree, contents_checksum_buf);
@ -2976,11 +2871,9 @@ ostree_repo_write_mtree (OstreeRepo *self,
ret_file = G_FILE (_ostree_repo_file_new_root (self, contents_checksum_buf, metadata_checksum)); ret_file = G_FILE (_ostree_repo_file_new_root (self, contents_checksum_buf, metadata_checksum));
} }
ret = TRUE;
if (out_file) if (out_file)
*out_file = g_steal_pointer (&ret_file); *out_file = g_steal_pointer (&ret_file);
out: return TRUE;
return ret;
} }
/** /**