lib/commit: Added new ostree_repo_write_archive_to_mtree_from_fd()
Similar to ostree_repo_write_archive_to_mtree(), but takes a file descriptor to read the archive from instead of mandating a file path. Usefull for importing archives into an OSTree repo over a socket or from standard input in command line tools. Closes: #1862 Approved by: jlebon
This commit is contained in:
1 parent
1c0933b40c
commit
da4d0245af
5 files changed
+110
-27
No files matched your search
@@ -44,9 +44,9 @@ typedef struct archive OtAutoArchiveRead;
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(OtAutoArchiveRead, archive_read_free)
|
||||
|
||||
static inline OtAutoArchiveRead *
|
||||
ot_open_archive_read (const char *path, GError **error)
|
||||
ot_archive_read_new (void)
|
||||
{
|
||||
g_autoptr(OtAutoArchiveRead) a = archive_read_new ();
|
||||
OtAutoArchiveRead *a = archive_read_new ();
|
||||
|
||||
#ifdef HAVE_ARCHIVE_READ_SUPPORT_FILTER_ALL
|
||||
archive_read_support_filter_all (a);
|
||||
@@ -54,10 +54,34 @@ ot_open_archive_read (const char *path, GError **error)
|
||||
archive_read_support_compression_all (a);
|
||||
#endif
|
||||
archive_read_support_format_all (a);
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
static inline OtAutoArchiveRead *
|
||||
ot_open_archive_read (const char *path, GError **error)
|
||||
{
|
||||
g_autoptr(OtAutoArchiveRead) a = ot_archive_read_new ();
|
||||
|
||||
if (archive_read_open_filename (a, path, 8192) != ARCHIVE_OK)
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
"%s", archive_error_string (a));
|
||||
"archive_read_open_filename: %s", archive_error_string (a));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return g_steal_pointer (&a);
|
||||
}
|
||||
|
||||
static inline OtAutoArchiveRead *
|
||||
ot_open_archive_read_fd (int fd, GError **error)
|
||||
{
|
||||
g_autoptr(OtAutoArchiveRead) a = ot_archive_read_new ();
|
||||
|
||||
if (archive_read_open_fd (a, fd, 8192) != ARCHIVE_OK)
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
"archive_read_open_fd: %s", archive_error_string (a));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user