Commit 5a85de93 5a85de932fc2c86dc3adc5bb671018af311fd3dd by Sergey Poznyakoff

(amd_msg_lookup): Bugfix. Use msg_count == 0 to determine if the msg_array is empty.

1 parent 34d108f4
......@@ -165,7 +165,7 @@ amd_msg_lookup (struct _amd_data *amd, struct _amd_message *msg,
int rc;
mu_off_t i;
if (!amd->msg_array)
if (amd->msg_count == 0)
{
*pret = 0;
return 1;
......@@ -549,12 +549,14 @@ _amd_message_save (struct _amd_data *amd, struct _amd_message *mhm, int expunge)
char buffer[512];
mu_envelope_t env = NULL;
status = mu_message_size (msg, &bsize);
if (status)
return status;
fp = _amd_tempfile (mhm->amd, &name);
if (!fp)
return errno;
mu_message_size (msg, &bsize);
/* Try to allocate large buffer */
for (; bsize > 1; bsize /= 2)
if ((buf = malloc (bsize)))
......