From 3cb66ed22a86f8e193f4a28cb8cc3ddd31f427bd Mon Sep 17 00:00:00 2001 From: Not Zed Date: Thu, 26 Sep 2002 05:56:12 +0000 Subject: Treat spool as a local folder, so the ref checks work right. 2002-09-26 Not Zed * tests/folder/test2.c (main): Treat spool as a local folder, so the ref checks work right. * providers/local/camel-spool-store.c (get_folder): Use creat() instead of open() to create file. svn path=/trunk/; revision=18231 --- camel/ChangeLog | 4 ++++ camel/providers/local/camel-spool-store.c | 4 +--- camel/tests/folder/test2.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/camel/ChangeLog b/camel/ChangeLog index ab75d5d5df..db2bf38a88 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,5 +1,8 @@ 2002-09-26 Not Zed + * tests/folder/test2.c (main): Treat spool as a local folder, so + the ref checks work right. + * providers/local/camel-spool-store.c (get_folder): Implement FOLDER_CREATE flag. (scan_dir): Dont free name on exception, its alloca'd. @@ -7,6 +10,7 @@ directly. (scan_dir): Allow empty files to also show up in folder list, as well as files starting with "From ". + (get_folder): Use creat() instead of open() to create file. * providers/local/camel-spool-folder.c (camel_spool_folder_new): Check folder != NULL before writing to it. diff --git a/camel/providers/local/camel-spool-store.c b/camel/providers/local/camel-spool-store.c index b1e7c7e091..dc35f75a2a 100644 --- a/camel/providers/local/camel-spool-store.c +++ b/camel/providers/local/camel-spool-store.c @@ -163,13 +163,11 @@ get_folder(CamelStore * store, const char *folder_name, guint32 flags, CamelExce camel_exception_setv(ex, CAMEL_EXCEPTION_STORE_NO_FOLDER, _("Folder `%s' does not exist."), folder_name); } else { - fd = open(name, O_CREAT, 0600); - if (fd == -1) { + if (creat(name, 0600) == -1) { camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, _("Could not create folder `%s':\n%s"), folder_name, strerror(errno)); } else { - close(fd); folder = camel_spool_folder_new(store, folder_name, flags, ex); } } diff --git a/camel/tests/folder/test2.c b/camel/tests/folder/test2.c index afd35b1704..57a449ff59 100644 --- a/camel/tests/folder/test2.c +++ b/camel/tests/folder/test2.c @@ -49,7 +49,7 @@ int main(int argc, char **argv) /* create a pseudo-spool file, and check that */ creat("/tmp/camel-test/testbox", 0600); - test_folder_message_ops(session, "spool:///tmp/camel-test/testbox", FALSE, "INBOX"); + test_folder_message_ops(session, "spool:///tmp/camel-test/testbox", TRUE, "INBOX"); check_unref(session, 1); camel_exception_free(ex); -- cgit