From: Timo Sirainen Date: Mon, 24 Feb 2003 18:45:38 +0000 (+0200) Subject: Fallback temp file creation into /tmp with in-memory indexes. Used only with X-Git-Tag: 1.1.alpha1~4859 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=faf2e57e02c1219612a8d030f2157b1266e27a9b;p=thirdparty%2Fdovecot%2Fcore.git Fallback temp file creation into /tmp with in-memory indexes. Used only with mbox rewriting. --HG-- branch : HEAD --- diff --git a/src/lib-index/mail-index-util.c b/src/lib-index/mail-index-util.c index bca9b64a5a..81c308215e 100644 --- a/src/lib-index/mail-index-util.c +++ b/src/lib-index/mail-index-util.c @@ -96,9 +96,12 @@ int mail_index_create_temp_file(struct mail_index *index, const char **path) hostpid_init(); /* use ".temp.host.pid" as temporary file name. unlink() it first, - just to be sure it's not symlinked somewhere for some reason.. */ - *path = t_strconcat(index->dir, "/.temp.", - my_hostname, ".", my_pid, NULL); + just to be sure it's not symlinked somewhere for some reason.. + FIXME: this function should rather be removed entirely. With + in-memory indexes index->dir is NULL, so we fallback to /tmp + so that mbox rewriting doesn't crash. */ + *path = t_strconcat(index->dir != NULL ? index->dir : "/tmp", + "/.temp.", my_hostname, ".", my_pid, NULL); (void)unlink(*path); /* usage of O_EXCL isn't exactly needed since the path should be