[ostree] g_output_stream_splice: check correctly the error code
- From: Giuseppe Scrivano <gscrivano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] g_output_stream_splice: check correctly the error code
- Date: Fri, 24 Apr 2015 16:26:55 +0000 (UTC)
commit cf30f8717a4ea56b79f4d382e3642779f104b24e
Author: Giuseppe Scrivano <gscrivan redhat com>
Date: Fri Apr 24 12:37:49 2015 +0200
g_output_stream_splice: check correctly the error code
While at it, change the style of other two occurrences.
Signed-off-by: Giuseppe Scrivano <gscrivan redhat com>
.../ostree-repo-static-delta-compilation.c | 11 +++++++----
.../ostree-repo-static-delta-processing.c | 13 ++++++++-----
src/ostree/ot-builtin-cat.c | 9 ++++++---
3 files changed, 21 insertions(+), 12 deletions(-)
---
diff --git a/src/libostree/ostree-repo-static-delta-compilation.c
b/src/libostree/ostree-repo-static-delta-compilation.c
index 51e5d10..0563e86 100644
--- a/src/libostree/ostree-repo-static-delta-compilation.c
+++ b/src/libostree/ostree-repo-static-delta-compilation.c
@@ -1344,10 +1344,13 @@ ostree_repo_static_delta_generate (OstreeRepo *self,
part_payload_out = (GMemoryOutputStream*)g_memory_output_stream_new (NULL, 0, g_realloc, g_free);
part_payload_compressor = (GConverterOutputStream*)g_converter_output_stream_new
((GOutputStream*)part_payload_out, compressor);
- if (0 > g_output_stream_splice ((GOutputStream*)part_payload_compressor, part_payload_in,
- G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET |
G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE,
- cancellable, error))
- goto out;
+ {
+ gssize n_bytes_written = g_output_stream_splice ((GOutputStream*)part_payload_compressor,
part_payload_in,
+ G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET |
G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE,
+ cancellable, error);
+ if (n_bytes_written < 0)
+ goto out;
+ }
/* FIXME - avoid duplicating memory here */
delta_part = g_variant_new ("(y ay)",
diff --git a/src/libostree/ostree-repo-static-delta-processing.c
b/src/libostree/ostree-repo-static-delta-processing.c
index 9a9e69f..79c0a0e 100644
--- a/src/libostree/ostree-repo-static-delta-processing.c
+++ b/src/libostree/ostree-repo-static-delta-processing.c
@@ -294,11 +294,14 @@ decompress_all (GConverter *converter,
gs_unref_object GMemoryOutputStream *memout = (GMemoryOutputStream*)g_memory_output_stream_new (NULL, 0,
g_realloc, g_free);
gs_unref_object GInputStream *convin = g_converter_input_stream_new ((GInputStream*)memin, converter);
- if (0 > g_output_stream_splice ((GOutputStream*)memout, convin,
- G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE |
- G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET,
- cancellable, error))
- goto out;
+ {
+ gssize n_bytes_written = g_output_stream_splice ((GOutputStream*)memout, convin,
+ G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE |
+ G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET,
+ cancellable, error);
+ if (n_bytes_written < 0)
+ goto out;
+ }
ret = TRUE;
*out_uncompressed = g_memory_output_stream_steal_as_bytes (memout);
diff --git a/src/ostree/ot-builtin-cat.c b/src/ostree/ot-builtin-cat.c
index 721f992..8eff545 100644
--- a/src/ostree/ot-builtin-cat.c
+++ b/src/ostree/ot-builtin-cat.c
@@ -46,9 +46,12 @@ cat_one_file (GFile *f,
if (!in)
goto out;
- if (!g_output_stream_splice (stdout_stream, in, G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE,
- cancellable, error))
- goto out;
+ {
+ gssize n_bytes_written = g_output_stream_splice (stdout_stream, in, G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE,
+ cancellable, error);
+ if (n_bytes_written < 0)
+ goto out;
+ }
ret = TRUE;
out:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]