From 999f87a9bdb8afd80d1a5ecc083f90393df47efd Mon Sep 17 00:00:00 2001 From: alexhudson Date: Sun, 23 Dec 2007 20:24:55 +0000 Subject: [PATCH] Fix up mail delivery wot I broked. --- src/agents/store/maildir.c | 4 ++-- src/agents/store/store.c | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/agents/store/maildir.c b/src/agents/store/maildir.c index 44531c7..80df60c 100644 --- a/src/agents/store/maildir.c +++ b/src/agents/store/maildir.c @@ -109,9 +109,9 @@ MaildirTempDocument(StoreClient *client, uint64_t collection, char *dest, size_t int MaildirDeliverTempDocument(StoreClient *client, uint64_t collection, const char *path, uint64_t uid) { - char newpath[XPL_MAX_PATH]; + char newpath[XPL_MAX_PATH+1]; - snprintf(newpath, XPL_MAX_PATH, "%s" GUID_FMT "/cur/" GUID_FMT, client->store, collection, uid); + FindPathToDocument(client, collection, uid, &newpath, XPL_MAX_PATH); if (link(path, newpath) != 0) { // look at errno. EEXIST suggests we already delivered it; maybe ignore that? diff --git a/src/agents/store/store.c b/src/agents/store/store.c index 2eef6e9..81a16c9 100644 --- a/src/agents/store/store.c +++ b/src/agents/store/store.c @@ -664,7 +664,6 @@ ImportIncomingMail(StoreClient *client) int dcode = 0; DStoreDocInfo collinfo; NLockStruct *collLock; - char path[XPL_MAX_PATH+1]; char tmppath[XPL_MAX_PATH+1]; FILE *destfile = NULL; char buffer[CONN_BUFSIZE]; @@ -736,8 +735,11 @@ ImportIncomingMail(StoreClient *client) if (MaildirDeliverTempDocument(client, info.collection, tmppath, info.guid) != 0) goto finish; + + // Mail is no longer in the temporary file + FindPathToDocument(client, info.collection, info.guid, tmppath, sizeof(tmppath)); - if (StoreProcessDocument(client, &info, &collinfo, path, index, 0)) { + if (StoreProcessDocument(client, &info, &collinfo, tmppath, index, 0)) { /* we were unable to process this message for some reason, so let's save it to the side and skip over it */