git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Avoid a divide by zero if there's no messages to send.

From
MMMike McCormack <mike@codeweavers.com>
Date
Apr 5, 2006, 14:22 UTC
Message-ID
<4433D2BC.4000306@codeweavers.com>
---
  imap-send.c |    7 ++++++-
  1 files changed, 6 insertions(+), 1 deletions(-)
8f910a131c905720e9640ddecfd8f85927ddc660
diff --git a/imap-send.c b/imap-send.c
index d04259a..52e2400 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -1333,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) {
@@ -1340,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) {
Message 1 of 1 in “Avoid a divide by zero if there's no messages to send.”
  1. Avoid a divide by zero if there's no messages to send.Mike McCormack, Apr 5, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.