Commit 570a247f 570a247fe037dd6084a4f0623e5c7613051d8c91 by Sergey Poznyakoff

amd_expunge): Unlink the message file if msg_file_name returns NULL.

1 parent 48a6db10
......@@ -820,14 +820,19 @@ amd_expunge (mailbox_t mailbox)
{
if (!mhm->deleted)
{
char *old_name, *new_name;
char *old_name = amd->msg_file_name (mhm, 0);
char *new_name = amd->msg_file_name (mhm, 1);
if (new_name)
{
/* Rename original message */
old_name = amd->msg_file_name (mhm, 0);
new_name = amd->msg_file_name (mhm, 1);
rename (old_name, new_name);
free (old_name);
free (new_name);
}
else
/* Unlink original file */
unlink (old_name);
free (old_name);
}
_amd_message_delete (amd, mhm);
/* Do not increase i! */
}
......