[gcab/wip/hughsie/future: 8/18] trivial: Return an error if we try to write an in-memory cfile
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gcab/wip/hughsie/future: 8/18] trivial: Return an error if we try to write an in-memory cfile
- Date: Wed, 13 Dec 2017 23:03:02 +0000 (UTC)
commit 87dc0c3a0ea4b2f05c4b68e18918ee5f59313dd1
Author: Richard Hughes <richard hughsie com>
Date: Tue Dec 12 21:35:27 2017 +0000
trivial: Return an error if we try to write an in-memory cfile
libgcab/gcab-cabinet.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/libgcab/gcab-cabinet.c b/libgcab/gcab-cabinet.c
index a1a64c4..f2405ae 100644
--- a/libgcab/gcab-cabinet.c
+++ b/libgcab/gcab-cabinet.c
@@ -282,7 +282,14 @@ gcab_cabinet_write (GCabCabinet *self,
if (file_callback)
file_callback (file, user_data);
- in = G_INPUT_STREAM (g_file_read (gcab_file_get_gfile (file), cancellable, error));
+ GFile *gfile = gcab_file_get_gfile (file);
+ if (gfile == NULL) {
+ g_set_error (error, GCAB_ERROR, GCAB_ERROR_FORMAT,
+ "No GFile for %s", gcab_file_get_name (file));
+ return FALSE;
+ }
+
+ in = G_INPUT_STREAM (g_file_read (gfile, cancellable, error));
if (in == NULL)
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]