Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/libdocument
diff options
context:
space:
mode:
authorChristian Persch <chpe@src.gnome.org>2009-02-15 13:51:30 (GMT)
committer Christian Persch <chpe@src.gnome.org>2009-02-15 13:51:30 (GMT)
commitf870dd6bcd19cbbe8f62a4c2b04c1c5bd440bd8b (patch)
treed2b6236ad52e40b1cecba00a8137f414da5cc13a /libdocument
parent6d536b8815d57852153f260e9985f6d98effd9d1 (diff)
Propagate all errors upwards.
* libdocument/ev-file-helpers.c: (get_mime_type_from_data): Propagate all errors upwards. svn path=/trunk/; revision=3438
Diffstat (limited to 'libdocument')
-rw-r--r--libdocument/ev-file-helpers.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/libdocument/ev-file-helpers.c b/libdocument/ev-file-helpers.c
index 0b82536..8d51301 100644
--- a/libdocument/ev-file-helpers.c
+++ b/libdocument/ev-file-helpers.c
@@ -239,6 +239,7 @@ get_mime_type_from_data (const gchar *uri, GError **error)
GFileInputStream *input_stream;
gssize size_read;
guchar buffer[1024];
+ gboolean retval;
file = g_file_new_for_uri (uri);
@@ -249,12 +250,15 @@ get_mime_type_from_data (const gchar *uri, GError **error)
}
size_read = g_input_stream_read (G_INPUT_STREAM (input_stream),
- buffer, 1024, NULL, NULL);
- g_input_stream_close (G_INPUT_STREAM (input_stream), NULL, error);
+ buffer, sizeof (buffer), NULL, error);
+ if (size_read == -1) {
+ g_object_unref (file);
+ return NULL;
+ }
+ retval = g_input_stream_close (G_INPUT_STREAM (input_stream), NULL, error);
g_object_unref (file);
-
- if (size_read == -1)
+ if (!retval)
return NULL;
return g_content_type_guess (NULL, /* no filename */