aboutsummaryrefslogtreecommitdiff
path: root/libsylph/utils.c
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2006-09-13 07:14:28 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2006-09-13 07:14:28 +0000
commitc9865e35f9eaca97abb9369c888535cf007838b4 (patch)
tree43485b03ede45154745518aef1b7e3a63690cd47 /libsylph/utils.c
parentd7ea96a449049db7de8e92d135b1d961c523a351 (diff)
fflush() stream before rewind() to ensure error checking.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1156 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph/utils.c')
-rw-r--r--libsylph/utils.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libsylph/utils.c b/libsylph/utils.c
index 3cee525e..525c9a1b 100644
--- a/libsylph/utils.c
+++ b/libsylph/utils.c
@@ -2811,6 +2811,10 @@ FILE *canonicalize_file_stream(FILE *src_fp, gint *length)
FILE_OP_ERROR("canonicalize_file_stream", "fgets");
err = TRUE;
}
+ if (fflush(dest_fp) == EOF) {
+ FILE_OP_ERROR("canonicalize_file_stream", "fflush");
+ err = TRUE;
+ }
if (err) {
fclose(dest_fp);
@@ -2967,6 +2971,11 @@ FILE *get_outgoing_rfc2822_file(FILE *fp)
goto file_error;
}
+ if (fflush(outfp) == EOF) {
+ FILE_OP_ERROR("get_outgoing_rfc2822_file", "fflush");
+ goto file_error;
+ }
+
rewind(outfp);
return outfp;
@@ -3234,6 +3243,11 @@ FILE *str_open_as_stream(const gchar *str)
fclose(fp);
return NULL;
}
+ if (fflush(fp) == EOF) {
+ FILE_OP_ERROR("str_open_as_stream", "fflush");
+ fclose(fp);
+ return NULL;
+ }
rewind(fp);
return fp;