changeset 1247:467e79a48848 HEAD

Fallback temp file creation into /tmp with in-memory indexes. Used only with mbox rewriting.
author Timo Sirainen <tss@iki.fi>
date Mon, 24 Feb 2003 20:45:38 +0200
parents d850b16d583f
children a85455157496
files src/lib-index/mail-index-util.c
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-index-util.c	Mon Feb 24 20:30:23 2003 +0200
+++ b/src/lib-index/mail-index-util.c	Mon Feb 24 20:45:38 2003 +0200
@@ -96,9 +96,12 @@
 	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