From 76606873f3c863940ae485f835d89586daa1521d Mon Sep 17 00:00:00 2001 From: Priit Laes Date: Wed, 18 Jun 2008 19:45:54 +0000 Subject: [PATCH] ** Fix a regression introduced with bug #534080 2008-06-18 Priit Laes ** 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 | 7 +++++++ camel/camel-stream-vfs.c | 8 ++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/camel/ChangeLog b/camel/ChangeLog index 57661c7..7204553 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,10 @@ +2008-06-18 Priit Laes + + ** 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 ** Fix for bug #340838 diff --git a/camel/camel-stream-vfs.c b/camel/camel-stream-vfs.c index bfd7dba..60cd8b5 100644 --- a/camel/camel-stream-vfs.c +++ b/camel/camel-stream-vfs.c @@ -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 -- 2.7.4