diff options
author | Jeffrey Stedfast <fejj@helixcode.com> | 2000-06-29 00:55:55 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2000-06-29 00:55:55 +0800 |
commit | 161fabb3552c44eb2e57563e40d5c80535c0a763 (patch) | |
tree | 869111fdb07289ccaf07d88ea9c06b1f27298dce /camel/providers/mbox/camel-mbox-store.c | |
parent | 97bf430fbb1980da4b683dbe4b63128f69483c5b (diff) | |
download | gsoc2013-evolution-161fabb3552c44eb2e57563e40d5c80535c0a763.tar.gz gsoc2013-evolution-161fabb3552c44eb2e57563e40d5c80535c0a763.tar.zst gsoc2013-evolution-161fabb3552c44eb2e57563e40d5c80535c0a763.zip |
General cleanup (camel_mbox_summary_sync): Fixed a memory leak and added
2000-06-28 Jeffrey Stedfast <fejj@helixcode.com>
* providers/mbox/camel-mbox-summary.c: General cleanup
(camel_mbox_summary_sync): Fixed a memory leak and added
CamelException handling.
* providers/mbox/camel-mbox-store.c (delete_folder): Fixed a
memory leak
* providers/mbox/camel-mbox-folder.c (mbox_append_message):
Default 'off_t seek' to -1 so as to make sure it's initialized
before it's used in the case of a bad stat() call.
(mbox_sync): Updated
(mbox_expunge): Updated
svn path=/trunk/; revision=3774
Diffstat (limited to 'camel/providers/mbox/camel-mbox-store.c')
-rw-r--r-- | camel/providers/mbox/camel-mbox-store.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/camel/providers/mbox/camel-mbox-store.c b/camel/providers/mbox/camel-mbox-store.c index c2d53f0072..42cb931927 100644 --- a/camel/providers/mbox/camel-mbox-store.c +++ b/camel/providers/mbox/camel-mbox-store.c @@ -98,7 +98,7 @@ camel_mbox_store_get_toplevel_dir (CamelMboxStore *store) { CamelURL *url = CAMEL_SERVICE (store)->url; - g_assert(url != NULL); + g_assert (url != NULL); return url->path; } @@ -132,8 +132,7 @@ get_folder (CamelStore *store, const char *folder_name, gboolean create, return NULL; } - fd = open (name, O_WRONLY | O_CREAT | O_APPEND, - S_IRUSR | S_IWUSR); + fd = open (name, O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR); g_free (name); if (fd == -1) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, @@ -169,8 +168,11 @@ delete_folder (CamelStore *store, const char *folder_name, CamelException *ex) name = g_strdup_printf ("%s%s", CAMEL_SERVICE (store)->url->path, folder_name); if (stat (name, &st) == -1) { - if (errno == ENOENT) + if (errno == ENOENT) { + /* file doesn't exist - it's kinda like deleting it ;-) */ + g_free (name); return; + } camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, "Could not delete folder `%s':\n%s", @@ -178,12 +180,14 @@ delete_folder (CamelStore *store, const char *folder_name, CamelException *ex) g_free (name); return; } + if (!S_ISREG (st.st_mode)) { camel_exception_setv (ex, CAMEL_EXCEPTION_STORE_NO_FOLDER, "`%s' is not a regular file.", name); g_free (name); return; } + if (st.st_size != 0) { camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_NON_EMPTY, "Folder `%s' is not empty. Not deleted.", @@ -213,8 +217,7 @@ delete_folder (CamelStore *store, const char *folder_name, CamelException *ex) } static char * -get_folder_name (CamelStore *store, const char *folder_name, - CamelException *ex) +get_folder_name (CamelStore *store, const char *folder_name, CamelException *ex) { /* For now, we don't allow hieararchy. FIXME. */ if (strchr (folder_name + 1, '/')) { |