[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-storage.c,1.52,1.53

cras at procontrol.fi cras at procontrol.fi
Thu Jun 26 03:31:05 EEST 2003


Update of /home/cvs/dovecot/src/lib-storage/index/mbox
In directory danu:/tmp/cvs-serv2430/lib-storage/index/mbox

Modified Files:
	mbox-storage.c 
Log Message:
When deleting directory, delete .imap dir under it first.



Index: mbox-storage.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/mbox/mbox-storage.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- mbox-storage.c	14 Jun 2003 17:38:06 -0000	1.52
+++ mbox-storage.c	25 Jun 2003 23:31:03 -0000	1.53
@@ -497,7 +497,20 @@
 	}
 
 	if (S_ISDIR(st.st_mode)) {
-		/* deleting a folder, only allow it if it's empty */
+		/* deleting a folder, only allow it if it's empty.
+		   Delete .imap folder before to make sure it goes empty. */
+		index_dir = t_strconcat(storage->index_dir, "/", name,
+					"/.imap", NULL);
+
+		if (index_dir != NULL && rmdir(index_dir) < 0 &&
+		    !ENOTFOUND(errno) && errno != ENOTEMPTY) {
+			if (!mbox_handle_errors(storage)) {
+				mail_storage_set_critical(storage,
+					"rmdir() failed for %s: %m", index_dir);
+				return FALSE;
+			}
+		}
+
 		if (rmdir(path) == 0)
 			return TRUE;
 



More information about the dovecot-cvs mailing list