Check for error return from mailbox_append_message
Showing
3 changed files
with
24 additions
and
9 deletions
... | @@ -37,6 +37,7 @@ mail_copy0 (int argc, char **argv, int mark) | ... | @@ -37,6 +37,7 @@ mail_copy0 (int argc, char **argv, int mark) |
37 | msgset_t *msglist = NULL, *mp; | 37 | msgset_t *msglist = NULL, *mp; |
38 | int sender = 0; | 38 | int sender = 0; |
39 | size_t total_size = 0, total_lines = 0, size; | 39 | size_t total_size = 0, total_lines = 0, size; |
40 | int status; | ||
40 | 41 | ||
41 | if (isupper (argv[0][0])) | 42 | if (isupper (argv[0][0])) |
42 | sender = 1; | 43 | sender = 1; |
... | @@ -72,14 +73,17 @@ mail_copy0 (int argc, char **argv, int mark) | ... | @@ -72,14 +73,17 @@ mail_copy0 (int argc, char **argv, int mark) |
72 | 73 | ||
73 | for (mp = msglist; mp; mp = mp->next) | 74 | for (mp = msglist; mp; mp = mp->next) |
74 | { | 75 | { |
75 | int status; | ||
76 | |||
77 | status = util_get_message (mbox, mp->msg_part[0], &msg); | 76 | status = util_get_message (mbox, mp->msg_part[0], &msg); |
78 | if (status) | 77 | if (status) |
79 | break; | 78 | break; |
80 | 79 | ||
81 | mailbox_append_message (mbx, msg); | 80 | status = mailbox_append_message (mbx, msg); |
82 | 81 | if (status) | |
82 | { | ||
83 | util_error (_("can't append message: %s"), mu_strerror (status)); | ||
84 | break; | ||
85 | } | ||
86 | |||
83 | message_size (msg, &size); | 87 | message_size (msg, &size); |
84 | total_size += size; | 88 | total_size += size; |
85 | message_lines (msg, &size); | 89 | message_lines (msg, &size); |
... | @@ -93,7 +97,8 @@ mail_copy0 (int argc, char **argv, int mark) | ... | @@ -93,7 +97,8 @@ mail_copy0 (int argc, char **argv, int mark) |
93 | } | 97 | } |
94 | } | 98 | } |
95 | 99 | ||
96 | fprintf (ofile, "\"%s\" %3d/%-5d\n", filename, total_lines, total_size); | 100 | if (status == 0) |
101 | fprintf (ofile, "\"%s\" %3d/%-5d\n", filename, total_lines, total_size); | ||
97 | 102 | ||
98 | mailbox_close (mbx); | 103 | mailbox_close (mbx); |
99 | mailbox_destroy (&mbx); | 104 | mailbox_destroy (&mbx); | ... | ... |
... | @@ -98,6 +98,8 @@ mail_mbox_commit () | ... | @@ -98,6 +98,8 @@ mail_mbox_commit () |
98 | && (attribute_is_userflag (attr, MAIL_ATTRIBUTE_MBOXED) | 98 | && (attribute_is_userflag (attr, MAIL_ATTRIBUTE_MBOXED) |
99 | || (!hold && attribute_is_read (attr)))) | 99 | || (!hold && attribute_is_read (attr)))) |
100 | { | 100 | { |
101 | int status; | ||
102 | |||
101 | if (!dest_mbox) | 103 | if (!dest_mbox) |
102 | { | 104 | { |
103 | char *name = getenv ("MBOX"); | 105 | char *name = getenv ("MBOX"); |
... | @@ -111,9 +113,14 @@ mail_mbox_commit () | ... | @@ -111,9 +113,14 @@ mail_mbox_commit () |
111 | } | 113 | } |
112 | } | 114 | } |
113 | 115 | ||
114 | mailbox_append_message (dest_mbox, msg); | 116 | status = mailbox_append_message (dest_mbox, msg); |
115 | attribute_set_deleted (attr); | 117 | if (status) |
116 | saved_count++; | 118 | util_error (_("can't append message: %s"), mu_strerror (status)); |
119 | else | ||
120 | { | ||
121 | attribute_set_deleted (attr); | ||
122 | saved_count++; | ||
123 | } | ||
117 | } | 124 | } |
118 | else if (!keepsave && attribute_is_userflag (attr, MAIL_ATTRIBUTE_SAVED)) | 125 | else if (!keepsave && attribute_is_userflag (attr, MAIL_ATTRIBUTE_SAVED)) |
119 | attribute_set_deleted (attr); | 126 | attribute_set_deleted (attr); | ... | ... |
... | @@ -521,7 +521,10 @@ mail_send0 (compose_env_t * env, int save_to) | ... | @@ -521,7 +521,10 @@ mail_send0 (compose_env_t * env, int save_to) |
521 | | MU_STREAM_CREAT); | 521 | | MU_STREAM_CREAT); |
522 | if (status == 0) | 522 | if (status == 0) |
523 | { | 523 | { |
524 | mailbox_append_message (mbx, msg); | 524 | status = mailbox_append_message (mbx, msg); |
525 | if (status) | ||
526 | util_error (_("can't append message: %s"), | ||
527 | mu_strerror (status)); | ||
525 | mailbox_close (mbx); | 528 | mailbox_close (mbx); |
526 | } | 529 | } |
527 | mailbox_destroy (&mbx); | 530 | mailbox_destroy (&mbx); | ... | ... |
-
Please register or sign in to post a comment