mirror of
https://github.com/ostreedev/ostree.git
synced 2025-03-16 10:50:43 +03:00
static-delta: Don't run bspatch when output object already exists
There is already a check that the destination object does not exist in all other cases when processing an incoming static delta. However, the bspatch case would still try to run and fail. Add an analogous check to that case as well. https://bugzilla.gnome.org/show_bug.cgi?id=756260
This commit is contained in:
parent
dd35e1b9cd
commit
f2b4a9e107
@ -530,32 +530,35 @@ dispatch_bspatch (OstreeRepo *repo,
|
||||
if (!read_varuint64 (state, &length, error))
|
||||
goto out;
|
||||
|
||||
input_mfile = g_mapped_file_new_from_fd (state->read_source_fd, FALSE, error);
|
||||
if (!input_mfile)
|
||||
goto out;
|
||||
if (!state->have_obj)
|
||||
{
|
||||
input_mfile = g_mapped_file_new_from_fd (state->read_source_fd, FALSE, error);
|
||||
if (!input_mfile)
|
||||
goto out;
|
||||
|
||||
buf = g_malloc0 (state->content_size);
|
||||
buf = g_malloc0 (state->content_size);
|
||||
|
||||
opaque.state = state;
|
||||
opaque.offset = offset;
|
||||
opaque.length = length;
|
||||
stream.read = bspatch_read;
|
||||
stream.opaque = &opaque;
|
||||
if (bspatch ((const guint8*)g_mapped_file_get_contents (input_mfile),
|
||||
g_mapped_file_get_length (input_mfile),
|
||||
buf,
|
||||
state->content_size,
|
||||
&stream) < 0)
|
||||
goto out;
|
||||
opaque.state = state;
|
||||
opaque.offset = offset;
|
||||
opaque.length = length;
|
||||
stream.read = bspatch_read;
|
||||
stream.opaque = &opaque;
|
||||
if (bspatch ((const guint8*)g_mapped_file_get_contents (input_mfile),
|
||||
g_mapped_file_get_length (input_mfile),
|
||||
buf,
|
||||
state->content_size,
|
||||
&stream) < 0)
|
||||
goto out;
|
||||
|
||||
if (!g_output_stream_write_all (state->content_out,
|
||||
buf,
|
||||
state->content_size,
|
||||
&bytes_written,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
if (!g_output_stream_write_all (state->content_out,
|
||||
buf,
|
||||
state->content_size,
|
||||
&bytes_written,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
|
||||
g_assert (bytes_written == state->content_size);
|
||||
g_assert (bytes_written == state->content_size);
|
||||
}
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
|
Loading…
x
Reference in New Issue
Block a user