From e4bbdf696cc2f23e9b1fc288d37a44eb27d9426d Mon Sep 17 00:00:00 2001 From: Matthew Loper Date: Mon, 14 Feb 2000 00:53:16 +0000 Subject: + * 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. svn path=/trunk/; revision=1767 --- ChangeLog | 7 +++++++ camel/camel-stream-fs.c | 11 +++++++++-- 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 + * 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); - } -- cgit