[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-storage.c,
1.110, 1.111
cras at dovecot.org
cras at dovecot.org
Wed Feb 9 23:16:31 EET 2005
Update of /var/lib/cvs/dovecot/src/lib-storage/index/mbox
In directory talvi:/tmp/cvs-serv29911
Modified Files:
mbox-storage.c
Log Message:
lstat() the root directory before trying to mkdir() it.
Index: mbox-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-storage.c,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -d -r1.110 -r1.111
--- mbox-storage.c 5 Feb 2005 12:01:51 -0000 1.110
+++ mbox-storage.c 9 Feb 2005 21:16:29 -0000 1.111
@@ -299,8 +299,13 @@
root_dir = t_strndup(root_dir, len-1);
/* make sure the directory exists */
- if (mkdir_parents(root_dir, CREATE_MODE) < 0 &&
- errno != EEXIST) {
+ if (lstat(root_dir, &st) == 0) {
+ /* yep, go ahead */
+ } else if (errno != ENOENT && errno != ENOTDIR) {
+ i_error("lstat(%s) failed: %m", root_dir);
+ return NULL;
+ } else if (mkdir_parents(root_dir, CREATE_MODE) < 0 &&
+ errno != EEXIST) {
i_error("mkdir_parents(%s) failed: %m", root_dir);
return NULL;
}
More information about the dovecot-cvs
mailing list