Commit 26c0e2e0 26c0e2e0321fe1205815b0c820cbc60b0623c210 by Sergey Poznyakoff

Check for error return from mailbox_append_message

1 parent 6f398b61
......@@ -37,6 +37,7 @@ mail_copy0 (int argc, char **argv, int mark)
msgset_t *msglist = NULL, *mp;
int sender = 0;
size_t total_size = 0, total_lines = 0, size;
int status;
if (isupper (argv[0][0]))
sender = 1;
......@@ -72,14 +73,17 @@ mail_copy0 (int argc, char **argv, int mark)
for (mp = msglist; mp; mp = mp->next)
{
int status;
status = util_get_message (mbox, mp->msg_part[0], &msg);
if (status)
break;
mailbox_append_message (mbx, msg);
status = mailbox_append_message (mbx, msg);
if (status)
{
util_error (_("can't append message: %s"), mu_strerror (status));
break;
}
message_size (msg, &size);
total_size += size;
message_lines (msg, &size);
......@@ -93,7 +97,8 @@ mail_copy0 (int argc, char **argv, int mark)
}
}
fprintf (ofile, "\"%s\" %3d/%-5d\n", filename, total_lines, total_size);
if (status == 0)
fprintf (ofile, "\"%s\" %3d/%-5d\n", filename, total_lines, total_size);
mailbox_close (mbx);
mailbox_destroy (&mbx);
......
......@@ -98,6 +98,8 @@ mail_mbox_commit ()
&& (attribute_is_userflag (attr, MAIL_ATTRIBUTE_MBOXED)
|| (!hold && attribute_is_read (attr))))
{
int status;
if (!dest_mbox)
{
char *name = getenv ("MBOX");
......@@ -111,9 +113,14 @@ mail_mbox_commit ()
}
}
mailbox_append_message (dest_mbox, msg);
attribute_set_deleted (attr);
saved_count++;
status = mailbox_append_message (dest_mbox, msg);
if (status)
util_error (_("can't append message: %s"), mu_strerror (status));
else
{
attribute_set_deleted (attr);
saved_count++;
}
}
else if (!keepsave && attribute_is_userflag (attr, MAIL_ATTRIBUTE_SAVED))
attribute_set_deleted (attr);
......
......@@ -521,7 +521,10 @@ mail_send0 (compose_env_t * env, int save_to)
| MU_STREAM_CREAT);
if (status == 0)
{
mailbox_append_message (mbx, msg);
status = mailbox_append_message (mbx, msg);
if (status)
util_error (_("can't append message: %s"),
mu_strerror (status));
mailbox_close (mbx);
}
mailbox_destroy (&mbx);
......