From: Christian Persch Date: Sun, 15 Feb 2009 13:51:30 +0000 (+0000) Subject: Propagate all errors upwards. X-Git-Tag: EVINCE_2_25_91~42 X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=f870dd6bcd19cbbe8f62a4c2b04c1c5bd440bd8b;p=evince.git Propagate all errors upwards. * libdocument/ev-file-helpers.c: (get_mime_type_from_data): Propagate all errors upwards. svn path=/trunk/; revision=3438 --- diff --git a/ChangeLog b/ChangeLog index 2a9a5120..6d465661 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-02-13 Christian Persch + + * libdocument/ev-file-helpers.c: (get_mime_type_from_data): Propagate + all errors upwards. + 2009-02-13 Christian Persch * libdocument/ev-file-helpers.c: (get_mime_type_from_data): Don't use diff --git a/libdocument/ev-file-helpers.c b/libdocument/ev-file-helpers.c index 0b82536c..8d51301c 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 */