diff options
author | Matthew Loper <mloper@src.gnome.org> | 2000-02-14 08:53:16 +0800 |
---|---|---|
committer | Matthew Loper <mloper@src.gnome.org> | 2000-02-14 08:53:16 +0800 |
commit | e4bbdf696cc2f23e9b1fc288d37a44eb27d9426d (patch) | |
tree | 9c8fa3c171a707e6553ebf8b2fb531b119598193 /camel | |
parent | 204e08f87074268e93e0ad5d04a1bb5764a0c91c (diff) | |
download | gsoc2013-evolution-e4bbdf696cc2f23e9b1fc288d37a44eb27d9426d.tar gsoc2013-evolution-e4bbdf696cc2f23e9b1fc288d37a44eb27d9426d.tar.gz gsoc2013-evolution-e4bbdf696cc2f23e9b1fc288d37a44eb27d9426d.tar.bz2 gsoc2013-evolution-e4bbdf696cc2f23e9b1fc288d37a44eb27d9426d.tar.lz gsoc2013-evolution-e4bbdf696cc2f23e9b1fc288d37a44eb27d9426d.tar.xz gsoc2013-evolution-e4bbdf696cc2f23e9b1fc288d37a44eb27d9426d.tar.zst gsoc2013-evolution-e4bbdf696cc2f23e9b1fc288d37a44eb27d9426d.zip |
+ * 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
Diffstat (limited to 'camel')
-rw-r--r-- | camel/camel-stream-fs.c | 11 |
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); - } |