Mercurial > dovecot > core-2.2
diff src/lib-storage/index/mbox/mbox-save.c @ 2986:51a05fd00324 HEAD
Named pipes are now treated as write-only mboxes.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 17 Dec 2004 02:05:54 +0200 |
parents | 982e7432276f |
children | 61c8d205d887 |
line wrap: on
line diff
--- a/src/lib-storage/index/mbox/mbox-save.c Thu Dec 16 22:41:15 2004 +0200 +++ b/src/lib-storage/index/mbox/mbox-save.c Fri Dec 17 02:05:54 2004 +0200 @@ -68,6 +68,11 @@ char ch; int fd; + if (ctx->ibox->mbox_writeonly) { + *offset = 0; + return 0; + } + fd = ctx->ibox->mbox_fd; if (fstat(fd, &st) < 0) return mbox_set_syscall_error(ctx->ibox, "fstat()"); @@ -146,6 +151,11 @@ size_t len; int ret = 0; + if (ctx->ibox->mbox_writeonly) { + /* we can't seek, don't set Content-Length */ + return 0; + } + end_offset = ctx->output->offset; /* write Content-Length headers */ @@ -541,9 +551,10 @@ &ctx->next_uid, sizeof(ctx->next_uid)); } - if (!ctx->synced && ctx->ibox->mbox_fd != -1) { + if (!ctx->synced && ctx->ibox->mbox_fd != -1 && + !ctx->ibox->mbox_writeonly) { if (fdatasync(ctx->ibox->mbox_fd) < 0) { - mbox_set_syscall_error(ctx->ibox, "fsync()"); + mbox_set_syscall_error(ctx->ibox, "fdatasync()"); ret = -1; } }