mail-index-util.c revision 742111fa99a5b852c9645080573d5853be3907a7
285f3c4cf828ebe9ff345080aa1df3755613af29Timo Sirainen/* Copyright (C) 2002 Timo Sirainen */
285f3c4cf828ebe9ff345080aa1df3755613af29Timo Sirainenint index_set_error(struct mail_index *index, const char *fmt, ...)
285f3c4cf828ebe9ff345080aa1df3755613af29Timo Sirainenint index_set_corrupted(struct mail_index *index, const char *fmt, ...)
285f3c4cf828ebe9ff345080aa1df3755613af29Timo Sirainen index_set_error(index, "Corrupted index file %s: %s",
285f3c4cf828ebe9ff345080aa1df3755613af29Timo Sirainenint index_set_syscall_error(struct mail_index *index, const char *function)
285f3c4cf828ebe9ff345080aa1df3755613af29Timo Sirainen index_set_error(index, "%s failed with index file %s: %m",
285f3c4cf828ebe9ff345080aa1df3755613af29Timo Sirainenint index_file_set_syscall_error(struct mail_index *index, const char *filepath,
285f3c4cf828ebe9ff345080aa1df3755613af29Timo Sirainen index_set_error(index, "%s failed with file %s: %m",
285f3c4cf828ebe9ff345080aa1df3755613af29Timo Sirainenvoid index_reset_error(struct mail_index *index)
285f3c4cf828ebe9ff345080aa1df3755613af29Timo Sirainenint mail_index_create_temp_file(struct mail_index *index, const char **path)
285f3c4cf828ebe9ff345080aa1df3755613af29Timo Sirainen /* use ".temp.host.pid" as temporary file name. unlink() it first,
285f3c4cf828ebe9ff345080aa1df3755613af29Timo Sirainen just to be sure it's not symlinked somewhere for some reason..
285f3c4cf828ebe9ff345080aa1df3755613af29Timo Sirainen FIXME: this function should rather be removed entirely. With
285f3c4cf828ebe9ff345080aa1df3755613af29Timo Sirainen in-memory indexes index->dir is NULL, so we fallback to /tmp
285f3c4cf828ebe9ff345080aa1df3755613af29Timo Sirainen so that mbox rewriting doesn't crash. */
285f3c4cf828ebe9ff345080aa1df3755613af29Timo Sirainen *path = t_strconcat(index->dir != NULL ? index->dir : "/tmp",
*path);
return fd;
int ret;
if (ret < 0)
if (ret == 0) {
return FALSE;
return TRUE;