X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/605516b7c2e68efcd681478d40b210e6af968d58..63621a81d16ab743de6b57d47578a9a2c670ad22:/uip/post.c diff --git a/uip/post.c b/uip/post.c index 08e52426..69fe6b86 100644 --- a/uip/post.c +++ b/uip/post.c @@ -15,8 +15,8 @@ #include #include #include -#include "../sbr/m_mktemp.h" -#include "../sbr/message_id.h" +#include "sbr/m_mktemp.h" +#include "sbr/message_id.h" #ifdef HAVE_SYS_TIME_H # include @@ -290,7 +290,7 @@ static char *partno = NULL; static void putfmt (char *, char *, int *, FILE *); static void start_headers (void); static void finish_headers (FILE *); -static int get_header (char *, struct headers *); +static int get_header (char *, struct headers *) PURE; static int putadr (char *, char *, struct mailname *, FILE *, unsigned int, char *, unsigned int); static void putgrp (char *, char *, FILE *, unsigned int); @@ -301,12 +301,12 @@ static int annoaux (struct mailname *); static void insert_fcc (struct headers *, char *); static void make_bcc_file (int); static void verify_all_addresses (int, int, char *, int, char *); -static void chkadr (void); +static void chkadr (void) PURE; static void sigon (void); static void sigoff (void); static void p_refile (char *); static void fcc (char *, char *); -static void die (char *, char *, ...); +static void fatal (char *, char *, ...) CHECK_PRINTF(2, 3); static void post (char *, int, int, int, char *, int, char *); static void do_text (char *file, int fd); static void do_an_address (struct mailname *, int); @@ -1512,8 +1512,7 @@ make_bcc_file (int dashstuff) * of MIME encapsulation. */ if (filter != NULL) { - for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++) - sleep (5); + child_id = fork(); switch (child_id) { case NOTOK: adios ("fork", "unable to"); @@ -1606,12 +1605,12 @@ static void chkadr (void) { if (badadr && unkadr) - die (NULL, "%d address%s unparsable, %d addressee%s undeliverable", + fatal (NULL, "%d address%s unparsable, %d addressee%s undeliverable", badadr, PLURALS(badadr), unkadr, PLURALS(badadr)); if (badadr) - die (NULL, "%d address%s unparsable", badadr, PLURALS(badadr)); + fatal (NULL, "%d address%s unparsable", badadr, PLURALS(badadr)); if (unkadr) - die (NULL, "%d addressee%s undeliverable", unkadr, PLURALS(unkadr)); + fatal (NULL, "%d addressee%s undeliverable", unkadr, PLURALS(unkadr)); } @@ -1652,7 +1651,7 @@ do_addresses (int bccque, int talk) chkadr (); if (rp_isbad (retval = sm_waend ())) - die (NULL, "problem ending addresses; %s", rp_string (retval)); + fatal (NULL, "problem ending addresses; %s", rp_string (retval)); } @@ -1669,7 +1668,7 @@ static void post (char *file, int bccque, int talk, int eai, char *envelope, int oauth_flag, char *auth_svc) { - int retval, i; + int retval; pid_t child_id; if (verbose) { @@ -1686,8 +1685,7 @@ post (char *file, int bccque, int talk, int eai, char *envelope, char **argp, *program; int argc; - for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++) - sleep (5); + child_id = fork(); switch (child_id) { case NOTOK: adios ("fork", "unable to"); @@ -1718,7 +1716,7 @@ post (char *file, int bccque, int talk, int eai, char *envelope, int eightbit = 0; if (fd == NOTOK) { - die (file, "unable to re-open"); + fatal (file, "unable to re-open"); } if (msgflags & MMIM && cte != UNKNOWN) { @@ -1728,7 +1726,7 @@ post (char *file, int bccque, int talk, int eai, char *envelope, } else { if (scan_input (fd, &eightbit) == NOTOK) { close (fd); - die (file, "problem reading from"); + fatal (file, "problem reading from"); } } @@ -1737,7 +1735,7 @@ post (char *file, int bccque, int talk, int eai, char *envelope, oauth_flag ? auth_svc : NULL, tlsflag)) || rp_isbad (retval = sm_winit (envelope, eai, eightbit))) { close (fd); - die (NULL, "problem initializing server; %s", rp_string (retval)); + fatal (NULL, "problem initializing server; %s", rp_string (retval)); } do_addresses (bccque, talk && verbose); @@ -1780,7 +1778,7 @@ verify_all_addresses (int talk, int eai, char *envelope, int oauth_flag, verbose, snoop, sasl, saslmech, user, oauth_flag ? auth_svc : NULL, tlsflag)) || rp_isbad (retval = sm_winit (envelope, eai, eightbit))) { - die (NULL, "problem initializing server; %s", rp_string (retval)); + fatal (NULL, "problem initializing server; %s", rp_string (retval)); } } @@ -1806,7 +1804,7 @@ verify_all_addresses (int talk, int eai, char *envelope, int oauth_flag, puts(" -- Address Verification Successful --"); if (!whomsw || checksw) - sm_end (DONE); + sm_end (whomsw ? OK : DONE); fflush (stdout); sigoff (); @@ -1870,7 +1868,7 @@ do_an_address (struct mailname *lp, int talk) default: if (!talk) fprintf (stderr, " %s: ", addr); - die (NULL, "unexpected response; %s", rp_string (retval)); + fatal (NULL, "unexpected response; %s", rp_string (retval)); } fflush (stdout); @@ -1887,11 +1885,11 @@ do_text (char *file, int fd) while ((state = read (fd, buf, sizeof(buf))) > 0) { if (rp_isbad (retval = sm_wtxt (buf, state))) - die (NULL, "problem writing text; %s\n", rp_string (retval)); + fatal (NULL, "problem writing text; %s\n", rp_string (retval)); } if (state == NOTOK) - die (file, "problem reading from"); + fatal (file, "problem reading from"); switch (retval = sm_wtend ()) { case RP_OK: @@ -1899,11 +1897,11 @@ do_text (char *file, int fd) case RP_NO: case RP_NDEL: - die (NULL, "posting failed; %s", rp_string (retval)); + fatal (NULL, "posting failed; %s", rp_string (retval)); break; default: - die (NULL, "unexpected response; %s", rp_string (retval)); + fatal (NULL, "unexpected response; %s", rp_string (retval)); } } @@ -1982,7 +1980,7 @@ static void fcc (char *file, char *folder) { pid_t child_id; - int i, status, argp; + int status, argp; char fold[BUFSIZ]; char **arglist, *program; @@ -1990,9 +1988,7 @@ fcc (char *file, char *folder) printf (" %sFcc %s: ", msgstate == RESENT ? "Resent-" : "", folder); fflush (stdout); - for (i = 0; (child_id = fork ()) == NOTOK && i < 5; i++) - sleep (5); - + child_id = fork(); switch (child_id) { case NOTOK: if (!verbose) @@ -2037,7 +2033,7 @@ fcc (char *file, char *folder) */ static void -die (char *what, char *fmt, ...) +fatal (char *what, char *fmt, ...) { int err; va_list ap;