Skip to content
Snippets Groups Projects
Commit 27eff17b authored by Stephan Bosch's avatar Stephan Bosch
Browse files

Fixed issue with opening relative paths as a mail file.

parent 77844c3f
No related branches found
No related tags found
No related merge requests found
...@@ -142,6 +142,19 @@ static struct mail_raw *mail_raw_create ...@@ -142,6 +142,19 @@ static struct mail_raw *mail_raw_create
pool_t pool; pool_t pool;
struct raw_mailbox *raw_box; struct raw_mailbox *raw_box;
struct mail_raw *mailr; struct mail_raw *mailr;
enum mail_error error;
if ( mailfile != NULL ) {
if ( *mailfile != '/') {
char cwd[PATH_MAX];
/* Expand relative paths */
if (getcwd(cwd, sizeof(cwd)) == NULL)
i_fatal("getcwd() failed: %m");
mailfile = t_strconcat(cwd, "/", mailfile, NULL);
}
}
pool = pool_alloconly_create("mail_raw", 1024); pool = pool_alloconly_create("mail_raw", 1024);
mailr = p_new(pool, struct mail_raw, 1); mailr = p_new(pool, struct mail_raw, 1);
...@@ -156,8 +169,10 @@ static struct mail_raw *mail_raw_create ...@@ -156,8 +169,10 @@ static struct mail_raw *mail_raw_create
MAILBOX_OPEN_NO_INDEX_FILES); MAILBOX_OPEN_NO_INDEX_FILES);
} }
if ( mailr->box == NULL ) if ( mailr->box == NULL ) {
i_fatal("Can't open mail stream as raw"); i_fatal("Can't open mail stream as raw: %s",
mail_storage_get_last_error(raw_ns->storage, &error));
}
if ( mailbox_sync(mailr->box, 0, 0, NULL ) < 0) { if ( mailbox_sync(mailr->box, 0, 0, NULL ) < 0) {
enum mail_error error; enum mail_error error;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.