Port to GLnxTmpfile
There's lots of mechanically replacing `OtTmpFile` with `GLnxTmpfile`; the biggest changes are in the commit path. Symlink commits are now very clearly separated from regular files. Symlinks are `OtCleanupUnlinkat`, and regular files are `GLnxTmpfile`. The commit codepath separates those as `_ostree_repo_commit_path_final()` and `_ostree_repo_commit_tmpf_final()`. A nice aspect of all of this is that they both *consume* the temporary on success. This avoids an extra spurious `unlink()` call. One of the biggest bits of code motion is in `commit_loose_regfile_object()`, which no longer needs to care about symlinks. For the most parth though it's just removing conditionals. Update submodule: libglnx Closes: #958 Approved by: jlebon
This commit is contained in:
1 parent
79f285d188
commit
5776d5dcc0
13 files changed
+278
-358
No files matched your search
@@ -3862,8 +3862,7 @@ sign_data (OstreeRepo *self,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
glnx_fd_close int tmp_fd = -1;
|
||||
g_autofree char *tmp_path = NULL;
|
||||
g_auto(GLnxTmpfile) tmpf = { 0, };
|
||||
g_autoptr(GOutputStream) tmp_signature_output = NULL;
|
||||
gpgme_ctx_t context = NULL;
|
||||
g_autoptr(GBytes) ret_signature = NULL;
|
||||
@@ -3874,9 +3873,9 @@ sign_data (OstreeRepo *self,
|
||||
g_autoptr(GMappedFile) signature_file = NULL;
|
||||
|
||||
if (!glnx_open_tmpfile_linkable_at (self->tmp_dir_fd, ".", O_RDWR | O_CLOEXEC,
|
||||
&tmp_fd, &tmp_path, error))
|
||||
&tmpf, error))
|
||||
goto out;
|
||||
tmp_signature_output = g_unix_output_stream_new (tmp_fd, FALSE);
|
||||
tmp_signature_output = g_unix_output_stream_new (tmpf.fd, FALSE);
|
||||
|
||||
context = ot_gpgme_new_ctx (homedir, error);
|
||||
if (!context)
|
||||
@@ -3930,7 +3929,7 @@ sign_data (OstreeRepo *self,
|
||||
if (!g_output_stream_close (tmp_signature_output, cancellable, error))
|
||||
goto out;
|
||||
|
||||
signature_file = g_mapped_file_new_from_fd (tmp_fd, FALSE, error);
|
||||
signature_file = g_mapped_file_new_from_fd (tmpf.fd, FALSE, error);
|
||||
if (!signature_file)
|
||||
goto out;
|
||||
ret_signature = g_mapped_file_get_bytes (signature_file);
|
||||
|
||||
Reference in new issue
Block a user