conflict with mailbox namespace.
--HG--
branch : HEAD
char *index_dir;
char *control_dir;
char *inbox_path; /* INBOX location */
+ char *temp_prefix; /* prefix for temporary files */
char *user; /* name of user accessing the storage */
/* Copyright (C) 2002-2003 Timo Sirainen */
#include "lib.h"
+#include "hostpid.h"
#include "home-expand.h"
#include "mkdir-parents.h"
#include "unlink-directory.h"
storage->storage.hierarchy_sep = hierarchy_sep;
storage->storage.namespace = i_strdup(namespace);
+ /* the default ".temp.xxx" prefix would be treated as directory */
+ storage->temp_prefix =
+ i_strconcat("temp.", my_hostname, ".", my_pid, ".", NULL);
+
storage->dir = i_strdup(home_expand(root_dir));
storage->inbox_path = i_strdup(home_expand(inbox_dir));
storage->index_dir = i_strdup(home_expand(index_dir));
index_storage_deinit(storage);
+ i_free(storage->temp_prefix);
i_free(storage->dir);
i_free(storage->inbox_path);
i_free(storage->index_dir);
"/" SUBSCRIPTION_FILE_NAME, NULL);
name = maildir_fix_mailbox_name(storage, name, FALSE);
- return subsfile_set_subscribed(_storage, path, name, set);
+ return subsfile_set_subscribed(_storage, path, storage->temp_prefix,
+ name, set);
}
static int maildir_get_mailbox_name_status(struct mail_storage *_storage,
path = t_strconcat(uidlist->ibox->control_dir,
"/" MAILDIR_UIDLIST_NAME, NULL);
old_mask = umask(0777 & ~uidlist->ibox->mail_create_mode);
- fd = file_dotlock_open(path, NULL, NULL, 0, 0,
- UIDLIST_LOCK_STALE_TIMEOUT, NULL, NULL);
+ fd = file_dotlock_open(path, uidlist->ibox->storage->temp_prefix,
+ NULL, 0, 0, UIDLIST_LOCK_STALE_TIMEOUT,
+ NULL, NULL);
umask(old_mask);
if (fd == -1) {
if (errno == EAGAIN)
path = t_strconcat(storage->dir, "/" SUBSCRIPTION_FILE_NAME, NULL);
name = mbox_fix_mailbox_name(storage, name, FALSE);
- return subsfile_set_subscribed(_storage, path, name, set);
+ return subsfile_set_subscribed(_storage, path, storage->temp_prefix,
+ name, set);
}
static int mbox_get_mailbox_name_status(struct mail_storage *_storage,
}
int subsfile_set_subscribed(struct mail_storage *storage, const char *path,
- const char *name, int set)
+ const char *temp_prefix, const char *name, int set)
{
const char *line;
struct istream *input;
name = "INBOX";
/* FIXME: set lock notification callback */
- fd_out = file_dotlock_open(path, NULL, NULL,
+ fd_out = file_dotlock_open(path, temp_prefix, NULL,
SUBSCRIPTION_FILE_LOCK_TIMEOUT,
SUBSCRIPTION_FILE_CHANGE_TIMEOUT,
SUBSCRIPTION_FILE_IMMEDIATE_TIMEOUT,
const char *subsfile_list_next(struct subsfile_list_context *ctx);
int subsfile_set_subscribed(struct mail_storage *storage, const char *path,
- const char *name, int set);
+ const char *temp_prefix, const char *name, int set);
#endif