Mercurial > dovecot > original-hg > dovecot-1.2
changeset 8208:f67d4a0d423b HEAD
Maildir++ quota: If directory for maildirsize doesn't exist, create it.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 22 Sep 2008 21:51:29 +0300 |
parents | 2442529e4cec |
children | 329d8757e5c2 |
files | src/plugins/quota/quota-maildir.c |
diffstat | 1 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/quota/quota-maildir.c Mon Sep 22 21:23:37 2008 +0300 +++ b/src/plugins/quota/quota-maildir.c Mon Sep 22 21:51:29 2008 +0300 @@ -5,6 +5,7 @@ #include "ioloop.h" #include "nfs-workarounds.h" #include "file-dotlock.h" +#include "mkdir-parents.h" #include "read-full.h" #include "write-full.h" #include "str.h" @@ -221,6 +222,7 @@ struct mail_storage *const *storages; unsigned int i, count; struct dotlock *dotlock; + const char *p, *dir; string_t *str; mode_t mode; gid_t gid; @@ -246,6 +248,18 @@ fd = file_dotlock_open_mode(&dotlock_settings, path, DOTLOCK_CREATE_FLAG_NONBLOCK, mode, (uid_t)-1, gid, &dotlock); + if (fd == -1 && errno == ENOENT) { + /* the control directory doesn't exist yet? create it */ + p = strrchr(path, '/'); + dir = t_strdup_until(path, p); + if (mkdir_parents(dir, 0700) < 0 && errno != EEXIST) { + i_error("mkdir_parents(%s) failed: %m", dir); + return -1; + } + fd = file_dotlock_open_mode(&dotlock_settings, path, + DOTLOCK_CREATE_FLAG_NONBLOCK, + mode, (uid_t)-1, gid, &dotlock); + } if (fd == -1) { if (errno == EAGAIN) { /* someone's just in the middle of updating it */