** Fix a regression introduced with bug #534080
authorPriit Laes <plaes@plaes.org>
Wed, 18 Jun 2008 19:45:54 +0000 (19:45 +0000)
committerPriit Laes <plaes@src.gnome.org>
Wed, 18 Jun 2008 19:45:54 +0000 (19:45 +0000)
2008-06-18  Priit Laes  <plaes@plaes.org>

** Fix a regression introduced with bug #534080

* camel-stream-vfs.c: (stream_write):
Return correct bytes_written on success and -1 on error.

svn path=/trunk/; revision=9005

camel/ChangeLog
camel/camel-stream-vfs.c

index 57661c7..7204553 100644 (file)
@@ -1,3 +1,10 @@
+2008-06-18  Priit Laes  <plaes@plaes.org>
+
+       ** Fix a regression introduced with bug #534080
+
+       * camel-stream-vfs.c: (stream_write):
+       Return correct bytes_written on success and -1 on error.
+
 2008-06-18  Milan Crha  <mcrha@redhat.com>
 
        ** Fix for bug #340838
index bfd7dba..60cd8b5 100644 (file)
@@ -211,20 +211,20 @@ stream_read (CamelStream *stream, char *buffer, size_t n)
 static ssize_t
 stream_write (CamelStream *stream, const char *buffer, size_t n)
 {
-       gssize nwritten;
+       gboolean success;
+       gsize bytes_written;
        GError *error = NULL;
        CamelStreamVFS *stream_vfs = CAMEL_STREAM_VFS (stream);
 
        g_return_val_if_fail (G_IS_OUTPUT_STREAM (stream_vfs->stream), 0);
 
-       nwritten = g_output_stream_write_all (G_OUTPUT_STREAM (stream_vfs->stream), buffer, n, NULL, NULL, &error);
+       success = g_output_stream_write_all (G_OUTPUT_STREAM (stream_vfs->stream), buffer, n, &bytes_written, NULL, &error);
 
        if (error) {
                g_warning ("%s", error->message);
                g_error_free (error);
        }
-
-       return nwritten;
+       return success ? bytes_written : -1;
 }
 
 static int