[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-storage.c,1.44,1.45

cras at procontrol.fi cras at procontrol.fi
Sun Mar 9 11:56:07 EET 2003


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

Modified Files:
	mbox-storage.c 
Log Message:
mbox: CREATE mailbox/ now mkdir()s it.



Index: mbox-storage.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/mbox/mbox-storage.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- mbox-storage.c	2 Mar 2003 22:41:45 -0000	1.44
+++ mbox-storage.c	9 Mar 2003 09:56:05 -0000	1.45
@@ -408,7 +408,8 @@
 	}
 }
 
-static int mbox_create_mailbox(struct mail_storage *storage, const char *name)
+static int mbox_create_mailbox(struct mail_storage *storage, const char *name,
+			       int only_hierarchy)
 {
 	const char *path, *p;
 	struct stat st;
@@ -444,13 +445,18 @@
 	}
 
 	/* create the hierarchy if needed */
-	p = strrchr(path, '/');
+	p = only_hierarchy ? path + strlen(path) : strrchr(path, '/');
 	if (p != NULL) {
 		if (mkdir_parents(t_strdup_until(path, p)) < 0) {
 			mail_storage_set_critical(storage,
 				"mkdir_parents() failed for mbox path %s: %m",
 				path);
 			return FALSE;
+		}
+
+		if (only_hierarchy) {
+			/* wanted to create only the directory */
+			return TRUE;
 		}
 	}
 




More information about the dovecot-cvs mailing list