X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=imap-send.c;h=52e2400b57118e7f9a27c85212e1c539d16add7c;hb=3742506578dda5de2fe97e403f04150a85ffef17;hp=f3cb79b1f8ea6fb2e21c89d6b1dba35e975aca30;hpb=521a3f676794987bfd03703fe58fbec46ed69d49;p=git.git diff --git a/imap-send.c b/imap-send.c index f3cb79b1..52e2400b 100644 --- a/imap-send.c +++ b/imap-send.c @@ -1202,6 +1202,7 @@ read_message( FILE *f, msg_data_t *msg ) p = xrealloc(msg->data, len+1); if (!p) break; + msg->data = p; } r = fread( &msg->data[msg->len], 1, len - msg->len, f ); if (r <= 0) @@ -1332,6 +1333,12 @@ main(int argc, char **argv) return 1; } + total = count_messages( &all_msgs ); + if (!total) { + fprintf(stderr,"no messages to send\n"); + return 1; + } + /* write it to the imap server */ ctx = imap_open_store( &server ); if (!ctx) { @@ -1339,7 +1346,6 @@ main(int argc, char **argv) return 1; } - total = count_messages( &all_msgs ); fprintf( stderr, "sending %d message%s\n", total, (total!=1)?"s":"" ); ctx->name = imap_folder; while (1) {