(amd_msg_lookup): Bugfix. Use msg_count == 0 to determine if the msg_array is empty.
Showing
1 changed file
with
5 additions
and
3 deletions
... | @@ -165,7 +165,7 @@ amd_msg_lookup (struct _amd_data *amd, struct _amd_message *msg, | ... | @@ -165,7 +165,7 @@ amd_msg_lookup (struct _amd_data *amd, struct _amd_message *msg, |
165 | int rc; | 165 | int rc; |
166 | mu_off_t i; | 166 | mu_off_t i; |
167 | 167 | ||
168 | if (!amd->msg_array) | 168 | if (amd->msg_count == 0) |
169 | { | 169 | { |
170 | *pret = 0; | 170 | *pret = 0; |
171 | return 1; | 171 | return 1; |
... | @@ -549,12 +549,14 @@ _amd_message_save (struct _amd_data *amd, struct _amd_message *mhm, int expunge) | ... | @@ -549,12 +549,14 @@ _amd_message_save (struct _amd_data *amd, struct _amd_message *mhm, int expunge) |
549 | char buffer[512]; | 549 | char buffer[512]; |
550 | mu_envelope_t env = NULL; | 550 | mu_envelope_t env = NULL; |
551 | 551 | ||
552 | status = mu_message_size (msg, &bsize); | ||
553 | if (status) | ||
554 | return status; | ||
555 | |||
552 | fp = _amd_tempfile (mhm->amd, &name); | 556 | fp = _amd_tempfile (mhm->amd, &name); |
553 | if (!fp) | 557 | if (!fp) |
554 | return errno; | 558 | return errno; |
555 | 559 | ||
556 | mu_message_size (msg, &bsize); | ||
557 | |||
558 | /* Try to allocate large buffer */ | 560 | /* Try to allocate large buffer */ |
559 | for (; bsize > 1; bsize /= 2) | 561 | for (; bsize > 1; bsize /= 2) |
560 | if ((buf = malloc (bsize))) | 562 | if ((buf = malloc (bsize))) | ... | ... |
-
Please register or sign in to post a comment