Check for error return from mailbox_append_message
Showing
3 changed files
with
20 additions
and
5 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,13 +73,16 @@ mail_copy0 (int argc, char **argv, int mark) | ... | @@ -72,13 +73,16 @@ 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); |
81 | if (status) | ||
82 | { | ||
83 | util_error (_("can't append message: %s"), mu_strerror (status)); | ||
84 | break; | ||
85 | } | ||
82 | 86 | ||
83 | message_size (msg, &size); | 87 | message_size (msg, &size); |
84 | total_size += size; | 88 | total_size += size; |
... | @@ -93,6 +97,7 @@ mail_copy0 (int argc, char **argv, int mark) | ... | @@ -93,6 +97,7 @@ mail_copy0 (int argc, char **argv, int mark) |
93 | } | 97 | } |
94 | } | 98 | } |
95 | 99 | ||
100 | if (status == 0) | ||
96 | fprintf (ofile, "\"%s\" %3d/%-5d\n", filename, total_lines, total_size); | 101 | fprintf (ofile, "\"%s\" %3d/%-5d\n", filename, total_lines, total_size); |
97 | 102 | ||
98 | mailbox_close (mbx); | 103 | mailbox_close (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,10 +113,15 @@ mail_mbox_commit () | ... | @@ -111,10 +113,15 @@ mail_mbox_commit () |
111 | } | 113 | } |
112 | } | 114 | } |
113 | 115 | ||
114 | mailbox_append_message (dest_mbox, msg); | 116 | status = mailbox_append_message (dest_mbox, msg); |
117 | if (status) | ||
118 | util_error (_("can't append message: %s"), mu_strerror (status)); | ||
119 | else | ||
120 | { | ||
115 | attribute_set_deleted (attr); | 121 | attribute_set_deleted (attr); |
116 | saved_count++; | 122 | saved_count++; |
117 | } | 123 | } |
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); |
120 | else if (attribute_is_read (attr)) | 127 | else if (attribute_is_read (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