aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-stream-fs.c
diff options
context:
space:
mode:
Diffstat (limited to 'camel/camel-stream-fs.c')
-rw-r--r--camel/camel-stream-fs.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/camel/camel-stream-fs.c b/camel/camel-stream-fs.c
index c6f81b7d88..26dde90803 100644
--- a/camel/camel-stream-fs.c
+++ b/camel/camel-stream-fs.c
@@ -230,7 +230,11 @@ _init_with_name (CamelStreamFs *stream_fs, const gchar *name, CamelStreamFsMode
}
if ( (mode & CAMEL_STREAM_FS_READ) && !(mode & CAMEL_STREAM_FS_WRITE) )
- if (v == -1) return;
+ if (v == -1) {
+ stream_fs->fd = -1;
+ return;
+ }
+
fd = open (name, flags, 0600);
if (fd==-1) {
@@ -268,9 +272,12 @@ camel_stream_fs_new_with_name (const gchar *name, CamelStreamFsMode mode)
CamelStreamFs *stream_fs;
stream_fs = gtk_type_new (camel_stream_fs_get_type ());
CSFS_CLASS (stream_fs)->init_with_name (stream_fs, name, mode);
+ if (stream_fs->fd == -1) {
+ gtk_object_destroy (GTK_OBJECT (stream_fs));
+ return NULL;
+ }
return CAMEL_STREAM (stream_fs);
-
}