+ * 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
This commit is contained in:
Matthew Loper
2000-02-14 00:53:16 +00:00
parent 204e08f870
commit e4bbdf696c
2 changed files with 16 additions and 2 deletions

View File

@ -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

View File

@ -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);
}