From: Jeremy Harris Date: Sat, 5 Aug 2017 14:51:36 +0000 (+0100) Subject: tidying X-Git-Tag: exim-4_90_RC1~97 X-Git-Url: https://git.exim.org/users/heiko/exim.git/commitdiff_plain/cab0c27721a3c1f3a146e44bcc6462eefb9eb9e7 tidying --- diff --git a/src/src/debug.c b/src/src/debug.c index 7a2e65632..09e03f1e4 100644 --- a/src/src/debug.c +++ b/src/src/debug.c @@ -191,7 +191,7 @@ if (debug_ptr == debug_buffer) t = timestamps_utc ? gmtime(&tmp) : localtime(&tmp); debug_ptr += sprintf(CS debug_ptr, LOGGING(millisec) ? "%02d:%02d:%02d.%03d " : "%02d:%02d:%02d ", - t->tm_hour, t->tm_min, t->tm_sec, now.tv_usec/1000); + t->tm_hour, t->tm_min, t->tm_sec, (int)(now.tv_usec/1000)); } DEBUG(D_pid) diff --git a/src/src/deliver.c b/src/src/deliver.c index 2713cc56f..e7ca9e054 100644 --- a/src/src/deliver.c +++ b/src/src/deliver.c @@ -7266,7 +7266,7 @@ if (addr_senddsn) FILE *f = fdopen(fd, "wb"); /* header only as required by RFC. only failure DSN needs to honor RET=FULL */ uschar * bound; - transport_ctx tctx = {0}; + transport_ctx tctx = {{0}}; DEBUG(D_deliver) debug_printf("sending error message to: %s\n", sender_address); @@ -7804,7 +7804,7 @@ wording. */ transport_filter_argv = NULL; /* Just in case */ return_path = sender_address; /* In case not previously set */ { /* Dummy transport for headers add */ - transport_ctx tctx = {0}; + transport_ctx tctx = {{0}}; transport_instance tb = {0}; tctx.u.fd = fileno(f); @@ -8126,7 +8126,7 @@ else if (addr_defer != (address_item *)(+1)) FILE *wmf = NULL; FILE *f = fdopen(fd, "wb"); uschar * bound; - transport_ctx tctx = {0}; + transport_ctx tctx = {{0}}; if (warn_message_file) if (!(wmf = Ufopen(warn_message_file, "rb"))) @@ -8514,7 +8514,7 @@ return new_sender_address; void delivery_re_exec(int exec_type) { -uschar * s; +uschar * where; if (cutthrough.fd >= 0 && cutthrough.callout_hold_only) { @@ -8530,11 +8530,11 @@ if (cutthrough.fd >= 0 && cutthrough.callout_hold_only) sending_ip_address = cutthrough.snd_ip; sending_port = cutthrough.snd_port; - s = US"socketpair"; + where = US"socketpair"; if (socketpair(AF_UNIX, SOCK_STREAM, 0, pfd) != 0) goto fail; - s = US"fork"; + where = US"fork"; if ((pid = fork()) < 0) goto fail; @@ -8562,12 +8562,12 @@ else cancel_cutthrough_connection(TRUE, US"non-continued delivery"); (void) child_exec_exim(exec_type, FALSE, NULL, FALSE, 2, US"-Mc", message_id); } -/* Control does not return here. */ +return; /* compiler quietening; control does not reach here. */ fail: log_write(0, LOG_MAIN | (exec_type == CEE_EXEC_EXIT ? LOG_PANIC : LOG_PANIC_DIE), - "delivery re-exec failed: %s", strerror(errno)); + "delivery re-exec %s failed: %s", where, strerror(errno)); /* Get here if exec_type == CEE_EXEC_EXIT. Note: this must be _exit(), not exit(). */ diff --git a/src/src/dkim_transport.c b/src/src/dkim_transport.c index 4d26f9291..1ef4cfa6c 100644 --- a/src/src/dkim_transport.c +++ b/src/src/dkim_transport.c @@ -200,7 +200,7 @@ int dkim_fd; int save_errno = 0; BOOL rc; uschar * dkim_spool_name, * dkim_signature; -int sread = 0, wwritten = 0, siglen = 0, options; +int siglen = 0, options; off_t k_file_size; const uschar * errstr; diff --git a/src/src/dns.c b/src/src/dns.c index 0408171e8..4950079b4 100644 --- a/src/src/dns.c +++ b/src/src/dns.c @@ -1016,7 +1016,7 @@ switch (type) assertion field. */ case T_CSA: { - uschar *srvname, *namesuff, *tld, *p; + uschar *srvname, *namesuff, *tld; int priority, weight, port; int limit, rc, i; BOOL ipv6; diff --git a/src/src/drtables.c b/src/src/drtables.c index 629953e58..c2419726e 100644 --- a/src/src/drtables.c +++ b/src/src/drtables.c @@ -19,8 +19,6 @@ all described in src/EDITME. */ lookup_info **lookup_list; int lookup_list_count = 0; -static int lookup_list_init_done = 0; - /* Table of information about all possible authentication mechanisms. All entries are always present if any mechanism is declared, but the functions are set to NULL for those that are not compiled into the binary. */ @@ -548,10 +546,12 @@ init_lookup_list(void) int moduleerrors = 0; #endif struct lookupmodulestr *p; + static BOOL lookup_list_init_done = FALSE; + if (lookup_list_init_done) return; - lookup_list_init_done = 1; + lookup_list_init_done = TRUE; #if defined(LOOKUP_CDB) && LOOKUP_CDB!=2 addlookupmodule(NULL, &cdb_lookup_module_info); diff --git a/src/src/exim.c b/src/src/exim.c index c990bc08c..725d4d4f5 100644 --- a/src/src/exim.c +++ b/src/src/exim.c @@ -212,8 +212,7 @@ int fd; os_restarting_signal(sig, usr1_handler); -fd = Uopen(process_log_path, O_APPEND|O_WRONLY, LOG_MODE); -if (fd < 0) +if ((fd = Uopen(process_log_path, O_APPEND|O_WRONLY, LOG_MODE)) < 0) { /* If we are already running as the Exim user, try to create it in the current process (assuming spool_directory exists). Otherwise, if we are @@ -4154,6 +4153,7 @@ if (Uchdir(spool_directory) != 0) int dummy; (void)directory_make(spool_directory, US"", SPOOL_DIRECTORY_MODE, FALSE); dummy = /* quieten compiler */ Uchdir(spool_directory); + dummy = dummy; /* yet more compiler quietening, sigh */ } /* Handle calls with the -bi option. This is a sendmail option to rebuild *the* diff --git a/src/src/queue.c b/src/src/queue.c index 60bf2ce77..8b0494b26 100644 --- a/src/src/queue.c +++ b/src/src/queue.c @@ -1133,7 +1133,7 @@ switch(action) { case MSG_SHOW_COPY: { - transport_ctx tctx = {0}; + transport_ctx tctx = {{0}}; deliver_in_buffer = store_malloc(DELIVER_IN_BUFFER_SIZE); deliver_out_buffer = store_malloc(DELIVER_OUT_BUFFER_SIZE); tctx.u.fd = 1; diff --git a/src/src/readconf.c b/src/src/readconf.c index 1ed93eb64..c3c74e277 100644 --- a/src/src/readconf.c +++ b/src/src/readconf.c @@ -372,7 +372,9 @@ static optionlist optionlist_config[] = { { "write_rejectlog", opt_bool, &write_rejectlog } }; +#ifndef MACRO_PREDEF static int optionlist_config_size = nelem(optionlist_config); +#endif #ifdef MACRO_PREDEF @@ -395,7 +397,7 @@ options_from_list(optionlist_auths, optionlist_auths_size, US"AUTHENTICATORS", N for (ai = auths_available; ai->driver_name[0]; ai++) { - spf(buf, sizeof(buf), "_DRIVER_AUTHENTICATOR_%T", ai->driver_name); + spf(buf, sizeof(buf), US"_DRIVER_AUTHENTICATOR_%T", ai->driver_name); builtin_macro_create(buf); options_from_list(ai->options, (unsigned)*ai->options_count, US"AUTHENTICATOR", ai->driver_name); } @@ -4390,6 +4392,7 @@ save_config_position(const uschar *file, int line) this operates on a global (static) list that holds all the pre-parsed config lines, we do no further processing here, output formatting and honouring of or macros will be done during output */ + static void save_config_line(const uschar* line) { diff --git a/src/src/retry.c b/src/src/retry.c index 0bb33a053..91c27104a 100644 --- a/src/src/retry.c +++ b/src/src/retry.c @@ -54,7 +54,7 @@ if (retry != NULL && retry->rules != NULL) last_rule = last_rule->next); DEBUG(D_retry) debug_printf(" received_time=%d diff=%d timeout=%d\n", - received_time.tv_sec, (int)(now - received_time.tv_sec), last_rule->timeout); + (int)received_time.tv_sec, (int)(now - received_time.tv_sec), last_rule->timeout); address_timeout = (now - received_time.tv_sec > last_rule->timeout); } else diff --git a/src/src/route.c b/src/src/route.c index 857fc65db..a175407c6 100644 --- a/src/src/route.c +++ b/src/src/route.c @@ -157,7 +157,7 @@ options_from_list(optionlist_routers, nelem(optionlist_routers), US"ROUTERS", NU for (ri = routers_available; ri->driver_name[0]; ri++) { - spf(buf, sizeof(buf), "_DRIVER_ROUTER_%T", ri->driver_name); + spf(buf, sizeof(buf), US"_DRIVER_ROUTER_%T", ri->driver_name); builtin_macro_create(buf); options_from_list(ri->options, (unsigned)*ri->options_count, US"ROUTER", ri->driver_name); } diff --git a/src/src/routers/accept.c b/src/src/routers/accept.c index c08a0c20b..b3a54e7cb 100644 --- a/src/src/routers/accept.c +++ b/src/src/routers/accept.c @@ -39,7 +39,7 @@ void accept_router_init(router_instance *rblock) {} int accept_router_entry(router_instance *rblock, address_item *addr, struct passwd *pw, int verify, address_item **addr_local, address_item **addr_remote, address_item **addr_new, - address_item **addr_succeed) {} + address_item **addr_succeed) {return 0;} #else /*!MACRO_PREDEF*/ diff --git a/src/src/routers/dnslookup.c b/src/src/routers/dnslookup.c index c1cbd4bf1..9e230b1be 100644 --- a/src/src/routers/dnslookup.c +++ b/src/src/routers/dnslookup.c @@ -53,7 +53,7 @@ void dnslookup_router_init(router_instance *rblock) {} int dnslookup_router_entry(router_instance *rblock, address_item *addr, struct passwd *pw, int verify, address_item **addr_local, address_item **addr_remote, address_item **addr_new, - address_item **addr_succeed) {} + address_item **addr_succeed) {return 0;} #else /*!MACRO_PREDEF*/ diff --git a/src/src/routers/ipliteral.c b/src/src/routers/ipliteral.c index c84bd952b..5cd6da52a 100644 --- a/src/src/routers/ipliteral.c +++ b/src/src/routers/ipliteral.c @@ -37,7 +37,7 @@ void ipliteral_router_init(router_instance *rblock) {} int ipliteral_router_entry(router_instance *rblock, address_item *addr, struct passwd *pw, int verify, address_item **addr_local, address_item **addr_remote, address_item **addr_new, - address_item **addr_succeed) {} + address_item **addr_succeed) {return 0;} #else /*!MACRO_PREDEF*/ diff --git a/src/src/routers/iplookup.c b/src/src/routers/iplookup.c index 9dd7f4fb5..fe0f961ae 100644 --- a/src/src/routers/iplookup.c +++ b/src/src/routers/iplookup.c @@ -53,7 +53,7 @@ void iplookup_router_init(router_instance *rblock) {} int iplookup_router_entry(router_instance *rblock, address_item *addr, struct passwd *pw, int verify, address_item **addr_local, address_item **addr_remote, address_item **addr_new, - address_item **addr_succeed) {} + address_item **addr_succeed) {return 0;} #else /*!MACRO_PREDEF*/ diff --git a/src/src/routers/manualroute.c b/src/src/routers/manualroute.c index 639185bd6..a695a9b6a 100644 --- a/src/src/routers/manualroute.c +++ b/src/src/routers/manualroute.c @@ -43,7 +43,7 @@ void manualroute_router_init(router_instance *rblock) {} int manualroute_router_entry(router_instance *rblock, address_item *addr, struct passwd *pw, int verify, address_item **addr_local, address_item **addr_remote, address_item **addr_new, - address_item **addr_succeed) {} + address_item **addr_succeed) {return 0;} #else /*!MACRO_PREDEF*/ diff --git a/src/src/routers/queryprogram.c b/src/src/routers/queryprogram.c index 535eb57e4..5dac6580a 100644 --- a/src/src/routers/queryprogram.c +++ b/src/src/routers/queryprogram.c @@ -49,7 +49,7 @@ void queryprogram_router_init(router_instance *rblock) {} int queryprogram_router_entry(router_instance *rblock, address_item *addr, struct passwd *pw, int verify, address_item **addr_local, address_item **addr_remote, address_item **addr_new, - address_item **addr_succeed) {} + address_item **addr_succeed) {return 0;} #else /*!MACRO_PREDEF*/ diff --git a/src/src/routers/redirect.c b/src/src/routers/redirect.c index 0ccc1a968..cb5dc6b58 100644 --- a/src/src/routers/redirect.c +++ b/src/src/routers/redirect.c @@ -142,7 +142,7 @@ void redirect_router_init(router_instance *rblock) {} int redirect_router_entry(router_instance *rblock, address_item *addr, struct passwd *pw, int verify, address_item **addr_local, address_item **addr_remote, address_item **addr_new, - address_item **addr_succeed) {} + address_item **addr_succeed) {return 0;} #else /*!MACRO_PREDEF*/ diff --git a/src/src/spool_mbox.c b/src/src/spool_mbox.c index de5830d64..432634094 100644 --- a/src/src/spool_mbox.c +++ b/src/src/spool_mbox.c @@ -216,8 +216,7 @@ if (spool_mbox_ok && !no_mbox_unspool) mbox_path = string_sprintf("%s/scan/%s", spool_directory, spooled_message_id); - tempdir = opendir(CS mbox_path); - if (!tempdir) + if (!(tempdir = opendir(CS mbox_path))) { debug_printf("Unable to opendir(%s): %s\n", mbox_path, strerror(errno)); /* Just in case we still can: */ @@ -225,7 +224,7 @@ if (spool_mbox_ok && !no_mbox_unspool) return; } /* loop thru dir & delete entries */ - while((entry = readdir(tempdir)) != NULL) + while((entry = readdir(tempdir))) { uschar *name = US entry->d_name; int dummy; @@ -233,7 +232,7 @@ if (spool_mbox_ok && !no_mbox_unspool) file_path = string_sprintf("%s/%s", mbox_path, name); debug_printf("unspool_mbox(): unlinking '%s'\n", file_path); - dummy = unlink(CS file_path); + dummy = unlink(CS file_path); dummy = dummy; /* compiler quietening */ } closedir(tempdir); diff --git a/src/src/spool_out.c b/src/src/spool_out.c index ac3927910..449662253 100644 --- a/src/src/spool_out.c +++ b/src/src/spool_out.c @@ -154,9 +154,9 @@ fprintf(f, "%s-H\n", message_id); fprintf(f, "%.63s %ld %ld\n", originator_login, (long int)originator_uid, (long int)originator_gid); fprintf(f, "<%s>\n", sender_address); -fprintf(f, "%d %d\n", received_time.tv_sec, warning_count); +fprintf(f, "%d %d\n", (int)received_time.tv_sec, warning_count); -fprintf(f, "-received_time_usec .%06d\n", received_time.tv_usec); +fprintf(f, "-received_time_usec .%06d\n", (int)received_time.tv_usec); /* If there is information about a sending host, remember it. The HELO data can be set for local SMTP as well as remote. */ diff --git a/src/src/tod.c b/src/src/tod.c index dac8b27f3..76b6d2da9 100644 --- a/src/src/tod.c +++ b/src/src/tod.c @@ -112,8 +112,10 @@ switch(type) break; case tod_log_datestamp_monthly: +#ifndef COMPILE_UTILITY off = sprintf(CS timebuf, "%04d%02d", 1900 + t->tm_year, 1 + t->tm_mon); +#endif break; #endif @@ -162,7 +164,7 @@ switch(type) (void) sprintf(CS timebuf, "%04d-%02d-%02d %02d:%02d:%02d.%03d %+03d%02d", 1900 + local.tm_year, 1 + local.tm_mon, local.tm_mday, - local.tm_hour, local.tm_min, local.tm_sec, now.tv_usec/1000, + local.tm_hour, local.tm_min, local.tm_sec, (int)(now.tv_usec/1000), diff_hour, diff_min); else #endif @@ -212,7 +214,9 @@ switch(type) #ifndef COMPILE_UTILITY if (LOGGING(millisec) && off > 0) - (void) sprintf(CS timebuf + off, ".%03d", now.tv_usec/1000); + (void) sprintf(CS timebuf + off, ".%03d", (int)(now.tv_usec/1000)); +#else +off = off; /* Compiler quietening */ #endif return timebuf; diff --git a/src/src/transport.c b/src/src/transport.c index c6b4c77ef..6dcc0c7d4 100644 --- a/src/src/transport.c +++ b/src/src/transport.c @@ -101,7 +101,7 @@ options_from_list(optionlist_transports, nelem(optionlist_transports), US"TRANSP for (ti = transports_available; ti->driver_name[0]; ti++) { - spf(buf, sizeof(buf), "_DRIVER_TRANSPORT_%T", ti->driver_name); + spf(buf, sizeof(buf), US"_DRIVER_TRANSPORT_%T", ti->driver_name); builtin_macro_create(buf); options_from_list(ti->options, (unsigned)*ti->options_count, US"TRANSPORT", ti->driver_name); } @@ -374,7 +374,7 @@ Returns: the yield of transport_write_block() BOOL transport_write_string(int fd, const char *format, ...) { -transport_ctx tctx = {0}; +transport_ctx tctx = {{0}}; va_list ap; va_start(ap, format); if (!string_vformat(big_buffer, big_buffer_size, format, ap)) @@ -1175,7 +1175,6 @@ BOOL save_spool_file_wireformat = spool_file_wireformat; int rc, len, yield, fd_read, fd_write, save_errno; int pfd[2] = {-1, -1}; pid_t filter_pid, write_pid; -static transport_ctx dummy_tctx = {0}; transport_filter_timed_out = FALSE; @@ -1381,6 +1380,7 @@ if (write_pid > 0) int dummy = read(pfd[pipe_read], (void *)&save_errno, sizeof(int)); dummy = read(pfd[pipe_read], (void *)&tctx->addr->more_errno, sizeof(int)); dummy = read(pfd[pipe_read], (void *)&tctx->addr->delivery_usec, sizeof(int)); + dummy = dummy; /* compiler quietening */ yield = FALSE; } } diff --git a/src/src/transports/appendfile.c b/src/src/transports/appendfile.c index a9abe8ad0..2e9326122 100644 --- a/src/src/transports/appendfile.c +++ b/src/src/transports/appendfile.c @@ -941,7 +941,7 @@ copy_mbx_message(int to_fd, int from_fd, off_t saved_size) int used; off_t size; struct stat statbuf; -transport_ctx tctx = {0}; +transport_ctx tctx = {{0}}; tctx.u.fd = to_fd; @@ -2917,7 +2917,7 @@ at initialization time. */ if (yield == OK) { transport_ctx tctx = { - fd, + {fd}, tblock, addr, ob->check_string, diff --git a/src/src/transports/autoreply.c b/src/src/transports/autoreply.c index ba6669b4d..7b3ff0228 100644 --- a/src/src/transports/autoreply.c +++ b/src/src/transports/autoreply.c @@ -694,7 +694,7 @@ if (return_message) : US"------ This is a copy of the message, including all the headers.\n"; transport_ctx tctx = { - fileno(f), + {fileno(f)}, tblock, addr, NULL, NULL, diff --git a/src/src/transports/lmtp.c b/src/src/transports/lmtp.c index 46215fb5f..002365ae7 100644 --- a/src/src/transports/lmtp.c +++ b/src/src/transports/lmtp.c @@ -621,7 +621,7 @@ if (send_data) { BOOL ok; transport_ctx tctx = { - fd_in, + {fd_in}, tblock, addrlist, US".", US"..", diff --git a/src/src/transports/pipe.c b/src/src/transports/pipe.c index 294b9fe7b..3f06b1dd6 100644 --- a/src/src/transports/pipe.c +++ b/src/src/transports/pipe.c @@ -563,7 +563,7 @@ const uschar *envlist = ob->environment; uschar *cmd, *ss; uschar *eol = ob->use_crlf ? US"\r\n" : US"\n"; transport_ctx tctx = { - 0, + {0}, tblock, addr, ob->check_string, diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c index d424c182c..1524972ce 100644 --- a/src/src/transports/smtp.c +++ b/src/src/transports/smtp.c @@ -1018,7 +1018,7 @@ if (is_esmtp && regex_match_and_setup(regex_AUTH, buffer, 0, -1)) If one is found, attempt to authenticate by calling its client function. */ - for (au = auths; !smtp_authenticated && au != NULL; au = au->next) + for (au = auths; !smtp_authenticated && au; au = au->next) { uschar *p = names; if (!au->client || @@ -1035,7 +1035,7 @@ if (is_esmtp && regex_match_and_setup(regex_AUTH, buffer, 0, -1)) /* Loop to scan supported server mechanisms */ - while (*p != 0) + while (*p) { int rc; int len = Ustrlen(au->public_name); @@ -2719,7 +2719,6 @@ struct timeval start_delivery_time; BOOL pass_message = FALSE; uschar *message = NULL; uschar new_message_id[MESSAGE_ID_LENGTH + 1]; -uschar *p; smtp_context sx; @@ -2890,7 +2889,7 @@ if (!(sx.peer_offered & OPTION_CHUNKING) && !sx.ok) else { transport_ctx tctx = { - sx.inblock.sock, + {sx.inblock.sock}, tblock, addrlist, US".", US"..", /* Escaping strings */