[libgsf] Gsf: add error checks on close.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgsf] Gsf: add error checks on close.
- Date: Mon, 1 Dec 2014 00:26:45 +0000 (UTC)
commit af8db4ad15543cbcc80e0e9f6f2bb51584004794
Author: Morten Welinder <terra gnome org>
Date: Sun Nov 30 19:26:11 2014 -0500
Gsf: add error checks on close.
We can fail on close for various reasons. it's not common, but we
should catch it.
ChangeLog | 3 +++
tools/gsf.c | 17 +++++++++++++----
2 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b89336a..babdcad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2014-11-30 Morten Welinder <terra gnome org>
+ * tools/gsf.c (gsf_create, load_recursively): Add error checks on
+ close.
+
* gsf/gsf-outfile-zip.c (gsf_outfile_zip_write): When zip64 is
forced off, don't allow writing beyond the 4G barrier.
(zip_header_write): If we write a real zip64 entry, mark the
diff --git a/tools/gsf.c b/tools/gsf.c
index bcf4471..a315873 100644
--- a/tools/gsf.c
+++ b/tools/gsf.c
@@ -431,13 +431,18 @@ load_recursively (GsfOutfile *outfile, char const *path)
"modtime", gsf_input_get_modtime (in),
NULL);
g_printerr ("Adding %s\n", path);
+
ok = gsf_input_copy (in, out);
- gsf_output_close (out);
+ if (!ok)
+ g_printerr ("Error in adding member.\n");
+
+ ok = gsf_output_close (out);
+ if (!ok)
+ g_printerr ("Error in adding member (at close)\n");
+
g_object_unref (out);
g_free (base);
- if (!ok)
- g_printerr ("Error in adding member.\n");
g_object_unref (in);
} else {
@@ -453,6 +458,7 @@ gsf_create (int argc, char **argv, GsfOutfileType type)
GsfOutput *dest;
GsfOutfile *outfile;
int i;
+ gboolean ok;
if (argc < 2)
return 1;
@@ -488,7 +494,10 @@ gsf_create (int argc, char **argv, GsfOutfileType type)
g_object_unref (file);
}
- gsf_output_close (GSF_OUTPUT (outfile));
+ ok = gsf_output_close (GSF_OUTPUT (outfile));
+ if (!ok)
+ g_printerr ("Error while closing archive\n");
+
g_object_unref (dest);
g_object_unref (outfile);
return 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]