aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--camel/camel-stream-fs.c11
2 files changed, 16 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 3c11bca8e2..0a32784414 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2000-02-13 Matt Loper <matt@helixcode.com>
+ * camel/camel-stream-fs.c (_init_with_name): Set stream_fs->fd to
+ -1 if we fail to load the file.
+ (camel_stream_fs_new_with_name): If stream_fs->fd is -1, return
+ NULL. These changes make it so that a CamelStreamFs won't be
+ created if you give it a bogus filename; they may be replaced once
+ exception handling is in place.
+
* tests/ui-tests/message-browser.c (handle_tree_item): Expand tree
items.
(mime_message_to_html): New function; translates a
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);
-
}