]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Fallback temp file creation into /tmp with in-memory indexes. Used only with
authorTimo Sirainen <tss@iki.fi>
Mon, 24 Feb 2003 18:45:38 +0000 (20:45 +0200)
committerTimo Sirainen <tss@iki.fi>
Mon, 24 Feb 2003 18:45:38 +0000 (20:45 +0200)
mbox rewriting.

--HG--
branch : HEAD

src/lib-index/mail-index-util.c

index bca9b64a5a75605b779f5491d65f4be9a0f7b213..81c308215ec5d7ee70bf4bfc563386908a8752fc 100644 (file)
@@ -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