aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2001-09-15 03:50:47 +0800
committerDan Winship <danw@src.gnome.org>2001-09-15 03:50:47 +0800
commitcf9e3919bc99b9f8482f9557022b54510b42f061 (patch)
treec051a1906aeee0888d57b0ca69b53c5619ca8a62 /camel
parent2fe33405860f002a63f97f0c85d62f774bcc6fb0 (diff)
downloadgsoc2013-evolution-cf9e3919bc99b9f8482f9557022b54510b42f061.tar
gsoc2013-evolution-cf9e3919bc99b9f8482f9557022b54510b42f061.tar.gz
gsoc2013-evolution-cf9e3919bc99b9f8482f9557022b54510b42f061.tar.bz2
gsoc2013-evolution-cf9e3919bc99b9f8482f9557022b54510b42f061.tar.lz
gsoc2013-evolution-cf9e3919bc99b9f8482f9557022b54510b42f061.tar.xz
gsoc2013-evolution-cf9e3919bc99b9f8482f9557022b54510b42f061.tar.zst
gsoc2013-evolution-cf9e3919bc99b9f8482f9557022b54510b42f061.zip
Don't claim failure when reading/writing the empty string.
* camel-file-utils.c (camel_file_util_encode_string, camel_file_util_decode_string): Don't claim failure when reading/writing the empty string. svn path=/trunk/; revision=12829
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog6
-rw-r--r--camel/camel-file-utils.c4
2 files changed, 8 insertions, 2 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index fbb1054370..a81532d531 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,9 @@
+2001-09-14 Dan Winship <danw@ximian.com>
+
+ * camel-file-utils.c (camel_file_util_encode_string,
+ camel_file_util_decode_string): Don't claim failure when
+ reading/writing the empty string.
+
2001-09-14 JP Rosevear <jpr@ximian.com>
* Makefile.am: use install hook instead of install rule to
diff --git a/camel/camel-file-utils.c b/camel/camel-file-utils.c
index 1b0fe65dbb..1411873cc4 100644
--- a/camel/camel-file-utils.c
+++ b/camel/camel-file-utils.c
@@ -237,7 +237,7 @@ camel_file_util_encode_string (FILE *out, const char *str)
len = strlen (str);
if (camel_file_util_encode_uint32 (out, len+1) == -1)
return -1;
- if (fwrite (str, len, 1, out) == 1)
+ if (len == 0 || fwrite (str, len, 1, out) == 1)
return 0;
return -1;
}
@@ -269,7 +269,7 @@ camel_file_util_decode_string (FILE *in, char **str)
}
ret = g_malloc (len+1);
- if (fread (ret, len, 1, in) != 1) {
+ if (len > 0 && fread (ret, len, 1, in) != 1) {
g_free (ret);
*str = NULL;
return -1;