[patch] Re: [Dovecot] Test migration (IMAP copy) and INTERNALDATE?]
I haven't been able to find what is responsible for altering the time on APPENDed mail, but was able to come up with a temporary workaround ... simply calling utime() later on in the process resolves it. Below is my patch. Steve --- dovecot-1.0.beta7-orig/src/lib-storage/index/maildir/maildir-save.c 2006-03-25 05:53:43.000000000 -0500 +++ dovecot-1.0.beta7/src/lib-storage/index/maildir/maildir-save.c 2006-04-19 09:47:32.000000000 -0400 @@ -70,9 +70,20 @@ t_strconcat(ctx->newdir, "/", basename, NULL) : t_strconcat(ctx->curdir, "/", dest, NULL); - if (link(tmp_path, new_path) == 0) + if (link(tmp_path, new_path) == 0) { ret = 0; - else { + if (ctx->received_date != (time_t)-1) { + struct utimbuf buf; + /* set the received_date by modifying mtime */ + buf.actime = ioloop_time; + buf.modtime = ctx->received_date; + if (utime(new_path, &buf) < 0) { + ctx->failed = TRUE; + mail_storage_set_critical(STORAGE(ctx->mbox->storage), + "utime(%s) failed: %m", new_path); + } + } + } else { ret = -1; if (ENOSPACE(errno)) { mail_storage_set_error(STORAGE(ctx->mbox->storage), @@ -332,18 +343,6 @@ t_push(); path = t_strconcat(ctx->tmpdir, "/", ctx->files->basename, NULL); - if (ctx->received_date != (time_t)-1) { - /* set the received_date by modifying mtime */ - buf.actime = ioloop_time; - buf.modtime = ctx->received_date; - - if (utime(path, &buf) < 0) { - ctx->failed = TRUE; - mail_storage_set_critical(STORAGE(ctx->mbox->storage), - "utime(%s) failed: %m", path); - } - } - output_errno = ctx->output->stream_errno; o_stream_destroy(&ctx->output);
participants (1)
-
Apps Lists