From: Jeremy Harris Date: Thu, 15 Sep 2016 22:58:57 +0000 (+0100) Subject: tidying X-Git-Tag: exim-4_88_RC1~6 X-Git-Url: https://git.exim.org/users/jgh/exim.git/commitdiff_plain/4dc2379ac1ab6c21f265abed06dd9aaa214976af tidying --- diff --git a/src/exim_monitor/em_TextPop.c b/src/exim_monitor/em_TextPop.c index faa51ed89..03f97da52 100644 --- a/src/exim_monitor/em_TextPop.c +++ b/src/exim_monitor/em_TextPop.c @@ -468,7 +468,7 @@ struct SearchAndReplace * search; text.firstPos = 0; text.format = FMT8BIT; - dir = (XawTextScanDirection)(int) ((caddr_t)XawToggleGetCurrent(search->left_toggle) - + dir = (XawTextScanDirection) ((long)XawToggleGetCurrent(search->left_toggle) - R_OFFSET); pos = XawTextSearch( tw, dir, &text); diff --git a/src/exim_monitor/em_menu.c b/src/exim_monitor/em_menu.c index dc24e3dfa..6deb909da 100644 --- a/src/exim_monitor/em_menu.c +++ b/src/exim_monitor/em_menu.c @@ -137,24 +137,24 @@ static void msglogAction(Widget w, XtPointer client_data, XtPointer call_data) { int i; -Widget text = text_create((uschar *)client_data, text_depth); -uschar * fname; -FILE *f = NULL; +Widget text = text_create(US client_data, text_depth); +uschar * fname = NULL; +FILE * f = NULL; w = w; /* Keep picky compilers happy */ call_data = call_data; /* End up with the split version, so message looks right when non-exist */ -for (i = 0; i < (spool_is_split? 2:1); i++) +for (i = 0; i < (spool_is_split ? 2:1); i++) { - message_subdir[0] = i != 0 ? ((uschar *)client_data)[5] : 0; + message_subdir[0] = i != 0 ? (US client_data)[5] : 0; fname = spool_fname(US"msglog", message_subdir, US client_data, US""); if ((f = fopen(CS fname, "r"))) break; } -if (f == NULL) +if (!f) text_showf(text, "%s: %s\n", fname, strerror(errno)); else { diff --git a/src/exim_monitor/em_strip.c b/src/exim_monitor/em_strip.c index 00675d46f..f0ad3abbb 100644 --- a/src/exim_monitor/em_strip.c +++ b/src/exim_monitor/em_strip.c @@ -58,12 +58,13 @@ a little game in order to ensure that the double value is correctly passed back via the value pointer without the compiler doing an unwanted cast. */ -static void stripchartAction(Widget w, XtPointer client_data, XtPointer value) +static void +stripchartAction(Widget w, XtPointer client_data, XtPointer value) { -double *ptr = (double *)value; +double * ptr = (double *)value; static int thresholds[] = {10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 0}; -int num = (int)client_data; +int num = (long)client_data; int oldmax = 0; int newmax = 0; int newvalue = 0; @@ -213,7 +214,8 @@ and for the second if it is a partition size display; its update time is initially set to 1 second so that it gives an immediate display of the queue. The first time its callback function is obeyed, the update time gets reset. */ -void create_stripchart(Widget parent, uschar *title) +void +create_stripchart(Widget parent, uschar *title) { Widget chart; @@ -249,7 +251,7 @@ xs_SetValues(chart, 11, XtNfromVert, label); XtAddCallback(chart, "getValue", stripchartAction, - (XtPointer)stripchart_count); + (XtPointer)(long)stripchart_count); stripchart_last_total[stripchart_count] = 0; stripchart_max[stripchart_count] = 10; diff --git a/src/src/daemon.c b/src/src/daemon.c index 779518f9f..64412c97d 100644 --- a/src/src/daemon.c +++ b/src/src/daemon.c @@ -868,7 +868,7 @@ while ((pid = waitpid(-1, &status, WNOHANG)) > 0) if (queue_pid_slots) { - int max = atoi(expand_string(queue_run_max)); + int max = atoi(CS expand_string(queue_run_max)); for (i = 0; i < max; i++) if (queue_pid_slots[i] == pid) { @@ -915,7 +915,7 @@ int *listen_sockets = NULL; int listen_socket_count = 0; ip_address_item *addresses = NULL; time_t last_connection_time = (time_t)0; -int local_queue_run_max = atoi(expand_string(queue_run_max)); +int local_queue_run_max = atoi(CS expand_string(queue_run_max)); /* If any debugging options are set, turn on the D_pid bit so that all debugging lines get the pid added. */ diff --git a/src/src/exim.c b/src/src/exim.c index 69d2edb8b..f2d0e9e65 100644 --- a/src/src/exim.c +++ b/src/src/exim.c @@ -3983,7 +3983,10 @@ if (timezone_string && strcmpic(timezone_string, US"UTC") == 0) else { uschar *envtz = US getenv("TZ"); - if (envtz ? !timezone_string || Ustrcmp(timezone_string, envtz) != 0 : timezone_string) + if (envtz + ? !timezone_string || Ustrcmp(timezone_string, envtz) != 0 + : timezone_string != NULL + ) { uschar **p = USS environ; uschar **new; diff --git a/src/src/exim_dbutil.c b/src/src/exim_dbutil.c index c7fd845f6..c710772ed 100644 --- a/src/src/exim_dbutil.c +++ b/src/src/exim_dbutil.c @@ -802,13 +802,13 @@ for(;;) if (record == NULL) printf("not found\n"); else { time_t tt; - int length = 0; /* Stops compiler warning */ + /*int length = 0; Stops compiler warning */ switch(dbdata_type) { case type_retry: retry = (dbdata_retry *)record; - length = sizeof(dbdata_retry) + Ustrlen(retry->text); + /* length = sizeof(dbdata_retry) + Ustrlen(retry->text); */ switch(fieldno) { @@ -858,7 +858,7 @@ for(;;) case type_callout: callout = (dbdata_callout_cache *)record; - length = sizeof(dbdata_callout_cache); + /* length = sizeof(dbdata_callout_cache); */ switch(fieldno) { case 0: diff --git a/src/src/expand.c b/src/src/expand.c index 0da210569..a7edaae47 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -7123,7 +7123,7 @@ while (*s != 0) const uschar * s = sub; uschar c; - for (s = sub; c = *s; s++) + for (s = sub; (c = *s); s++) yield = c < 127 && c != '\\' ? string_catn(yield, &size, &ptr, s, 1) : string_catn(yield, &size, &ptr, string_sprintf("\\%03o", c), 4); diff --git a/src/src/filter.c b/src/src/filter.c index f6e9b4655..59ab3192f 100644 --- a/src/src/filter.c +++ b/src/src/filter.c @@ -519,14 +519,14 @@ for (;;) string_item *aa; uschar *saveptr = ptr; ptr = nextword(ptr, buffer, sizeof(buffer), TRUE); - if (*error_pointer != NULL) break; + if (*error_pointer) break; if (Ustrcmp(buffer, "alias") != 0) { ptr = saveptr; break; } ptr = nextitem(ptr, buffer, sizeof(buffer), TRUE); - if (*error_pointer != NULL) break; + if (*error_pointer) break; aa = store_get(sizeof(string_item)); aa->text = string_copy(buffer); aa->next = c->left.a; @@ -540,7 +540,7 @@ for (;;) else if (Ustrcmp(buffer, "foranyaddress") == 0) { ptr = nextitem(ptr, buffer, sizeof(buffer), TRUE); - if (*error_pointer != NULL) break; + if (*error_pointer) break; if (*ptr != '(') { *error_pointer = string_sprintf("\"(\" expected after \"foranyaddress\" " @@ -552,18 +552,13 @@ for (;;) c->left.u = string_copy(buffer); ptr = read_condition(nextsigchar(ptr+1, TRUE), &(c->right.c), FALSE); - if (*error_pointer != NULL) break; + if (*error_pointer) break; if (*ptr != ')') { *error_pointer = string_sprintf("expected \")\" in line %d of " "filter file", line_number); break; } - if (!testfor) - { - c->testfor = !c->testfor; - testfor = TRUE; - } ptr = nextsigchar(ptr+1, TRUE); } @@ -577,7 +572,7 @@ for (;;) c->left.u = string_copy(buffer); ptr = nextword(ptr, buffer, sizeof(buffer), TRUE); - if (*error_pointer != NULL) break; + if (*error_pointer) break; /* Handle "does|is [not]", preserving the pointer after "is" in case it isn't that, but the form "is ". */ @@ -588,13 +583,13 @@ for (;;) if (buffer[0] == 'I') { c->type = cond_IS; isptr = ptr; } ptr = nextword(ptr, buffer, sizeof(buffer), TRUE); - if (*error_pointer != NULL) break; + if (*error_pointer) break; if (strcmpic(buffer, US"not") == 0) { c->testfor = !c->testfor; - if (isptr != NULL) isptr = ptr; + if (isptr) isptr = ptr; ptr = nextword(ptr, buffer, sizeof(buffer), TRUE); - if (*error_pointer != NULL) break; + if (*error_pointer) break; } } @@ -612,22 +607,19 @@ for (;;) if (i >= cond_word_count) { - if (isptr != NULL) - { - ptr = isptr; - } - else + if (!isptr) { *error_pointer = string_sprintf("unrecognized condition word \"%s\" " "near line %d of filter file", buffer, line_number); break; } + ptr = isptr; } /* Get the RH argument. */ ptr = nextitem(ptr, buffer, sizeof(buffer), TRUE); - if (*error_pointer != NULL) break; + if (*error_pointer) break; c->right.u = string_copy(buffer); } } @@ -664,7 +656,7 @@ for (;;) { uschar *saveptr = ptr; ptr = nextword(ptr, buffer, sizeof(buffer), FALSE); - if (*error_pointer != NULL) break; + if (*error_pointer) break; /* "Then" terminates a toplevel condition; otherwise a closing bracket has been omitted. Put a string terminator at the start of "then" so @@ -673,7 +665,7 @@ for (;;) if (Ustrcmp(buffer, "then") == 0) { if (toplevel) *saveptr = 0; - else *error_pointer = string_sprintf("missing \")\" at end of " + else *error_pointer = string_sprintf("missing \")\" at end of " "condition near line %d of filter file", line_number); break; } @@ -707,21 +699,21 @@ for (;;) condition_block *orc = store_get(sizeof(condition_block)); condition_block *or_parent = NULL; - if (current_parent != NULL) + if (current_parent) { - while (current_parent->parent != NULL && + while (current_parent->parent && current_parent->parent->type == cond_and) current_parent = current_parent->parent; /* If the parent has a parent, it must be an "or" parent. */ - if (current_parent->parent != NULL) + if (current_parent->parent) or_parent = current_parent->parent; } orc->parent = or_parent; - if (or_parent == NULL) *cond = orc; else - or_parent->right.c = orc; + if (!or_parent) *cond = orc; + else or_parent->right.c = orc; orc->type = cond_or; orc->testfor = TRUE; orc->left.c = (current_parent == NULL)? c : current_parent; diff --git a/src/src/parse.c b/src/src/parse.c index 9b7069f9e..3d942fd95 100644 --- a/src/src/parse.c +++ b/src/src/parse.c @@ -1444,7 +1444,7 @@ for (;;) with a flag that fails symlinks. */ { - int fd = open(directory, O_RDONLY); + int fd = open(CS directory, O_RDONLY); if (fd < 0) { *error = string_sprintf("failed to open directory %s", directory); @@ -1460,7 +1460,7 @@ for (;;) temp = *p; *p = '\0'; - fd2 = openat(fd, q, O_RDONLY|O_NOFOLLOW); + fd2 = openat(fd, CS q, O_RDONLY|O_NOFOLLOW); close(fd); *p = temp; if (fd2 < 0) diff --git a/src/src/pdkim/pdkim.c b/src/src/pdkim/pdkim.c index fd3c6bc2b..7bfcdf4aa 100644 --- a/src/src/pdkim/pdkim.c +++ b/src/src/pdkim/pdkim.c @@ -1423,7 +1423,7 @@ while (sig) /*XXX walk the list of headers in same order as received. */ for (hdrs = ctx->headers; hdrs; hdrs = hdrs->next) if ( hdrs->tag == 0 - && strncasecmp(hdrs->value, CS p, Ustrlen(p)) == 0 + && strncasecmp(CCS hdrs->value, CCS p, Ustrlen(p)) == 0 && (hdrs->value)[Ustrlen(p)] == ':' ) { diff --git a/src/src/queue.c b/src/src/queue.c index 16e18efc5..969eceba4 100644 --- a/src/src/queue.c +++ b/src/src/queue.c @@ -14,6 +14,7 @@ /* Routines with knowlege of spool layout */ +#ifndef COMPILE_UTILITY static void spool_pname_buf(uschar * buf, int len) { @@ -26,6 +27,7 @@ spool_dname(const uschar * purpose, uschar * subdir) return string_sprintf("%s/%s/%s/%s", spool_directory, queue_name, purpose, subdir); } +#endif uschar * spool_sname(const uschar * purpose, uschar * subdir) diff --git a/src/src/readconf.c b/src/src/readconf.c index fb9d47a09..26da6ba65 100644 --- a/src/src/readconf.c +++ b/src/src/readconf.c @@ -3022,220 +3022,220 @@ macros are stored, but this will do for now. Some names are awkward due to conflicts with other common macros. */ #ifdef SUPPORT_CRYPTEQ - read_macro_assignment("_HAVE_CRYPTEQ=y"); + read_macro_assignment(US"_HAVE_CRYPTEQ=y"); #endif #if HAVE_ICONV - read_macro_assignment("_HAVE_ICONV=y"); + read_macro_assignment(US"_HAVE_ICONV=y"); #endif #if HAVE_IPV6 - read_macro_assignment("_HAVE_IPV6=y"); + read_macro_assignment(US"_HAVE_IPV6=y"); #endif #ifdef HAVE_SETCLASSRESOURCES - read_macro_assignment("_HAVE_SETCLASSRESOURCES=y"); + read_macro_assignment(US"_HAVE_SETCLASSRESOURCES=y"); #endif #ifdef SUPPORT_PAM - read_macro_assignment("_HAVE_PAM=y"); + read_macro_assignment(US"_HAVE_PAM=y"); #endif #ifdef EXIM_PERL - read_macro_assignment("_HAVE_PERL=y"); + read_macro_assignment(US"_HAVE_PERL=y"); #endif #ifdef EXPAND_DLFUNC - read_macro_assignment("_HAVE_DLFUNC=y"); + read_macro_assignment(US"_HAVE_DLFUNC=y"); #endif #ifdef USE_TCP_WRAPPERS - read_macro_assignment("_HAVE_TCPWRAPPERS=y"); + read_macro_assignment(US"_HAVE_TCPWRAPPERS=y"); #endif #ifdef SUPPORT_TLS - read_macro_assignment("_HAVE_TLS=y"); + read_macro_assignment(US"_HAVE_TLS=y"); # ifdef USE_GNUTLS - read_macro_assignment("_HAVE_GNUTLS=y"); + read_macro_assignment(US"_HAVE_GNUTLS=y"); # else - read_macro_assignment("_HAVE_OPENSSL=y"); + read_macro_assignment(US"_HAVE_OPENSSL=y"); # endif #endif #ifdef SUPPORT_TRANSLATE_IP_ADDRESS - read_macro_assignment("_HAVE_TRANSLATE_IP_ADDRESS=y"); + read_macro_assignment(US"_HAVE_TRANSLATE_IP_ADDRESS=y"); #endif #ifdef SUPPORT_MOVE_FROZEN_MESSAGES - read_macro_assignment("_HAVE_MOVE_FROZEN_MESSAGES=y"); + read_macro_assignment(US"_HAVE_MOVE_FROZEN_MESSAGES=y"); #endif #ifdef WITH_CONTENT_SCAN - read_macro_assignment("_HAVE_CONTENT_SCANNING=y"); + read_macro_assignment(US"_HAVE_CONTENT_SCANNING=y"); #endif #ifndef DISABLE_DKIM - read_macro_assignment("_HAVE_DKIM=y"); + read_macro_assignment(US"_HAVE_DKIM=y"); #endif #ifndef DISABLE_DNSSEC - read_macro_assignment("_HAVE_DNSSEC=y"); + read_macro_assignment(US"_HAVE_DNSSEC=y"); #endif #ifndef DISABLE_EVENT - read_macro_assignment("_HAVE_Event=y"); + read_macro_assignment(US"_HAVE_Event=y"); #endif #ifdef SUPPORT_I18N - read_macro_assignment("_HAVE_I18N=y"); + read_macro_assignment(US"_HAVE_I18N=y"); #endif #ifndef DISABLE_OCSP - read_macro_assignment("_HAVE_OCSP=y"); + read_macro_assignment(US"_HAVE_OCSP=y"); #endif #ifndef DISABLE_PRDR - read_macro_assignment("_HAVE_PRDR=y"); + read_macro_assignment(US"_HAVE_PRDR=y"); #endif #ifdef SUPPORT_PROXY - read_macro_assignment("_HAVE_PROXY=y"); + read_macro_assignment(US"_HAVE_PROXY=y"); #endif #ifdef SUPPORT_SOCKS - read_macro_assignment("_HAVE_SOCKS=y"); + read_macro_assignment(US"_HAVE_SOCKS=y"); #endif #ifdef EXPERIMENTAL_LMDB - read_macro_assignment("_HAVE_LMDB=y"); + read_macro_assignment(US"_HAVE_LMDB=y"); #endif #ifdef EXPERIMENTAL_SPF - read_macro_assignment("_HAVE_SPF=y"); + read_macro_assignment(US"_HAVE_SPF=y"); #endif #ifdef EXPERIMENTAL_SRS - read_macro_assignment("_HAVE_SRS=y"); + read_macro_assignment(US"_HAVE_SRS=y"); #endif #ifdef EXPERIMENTAL_BRIGHTMAIL - read_macro_assignment("_HAVE_BRIGHTMAIL=y"); + read_macro_assignment(US"_HAVE_BRIGHTMAIL=y"); #endif #ifdef EXPERIMENTAL_DANE - read_macro_assignment("_HAVE_DANE=y"); + read_macro_assignment(US"_HAVE_DANE=y"); #endif #ifdef EXPERIMENTAL_DCC - read_macro_assignment("_HAVE_DCC=y"); + read_macro_assignment(US"_HAVE_DCC=y"); #endif #ifdef EXPERIMENTAL_DMARC - read_macro_assignment("_HAVE_DMARC=y"); + read_macro_assignment(US"_HAVE_DMARC=y"); #endif #ifdef EXPERIMENTAL_DSN_INFO - read_macro_assignment("_HAVE_DSN_INFO=y"); + read_macro_assignment(US"_HAVE_DSN_INFO=y"); #endif #ifdef LOOKUP_LSEARCH - read_macro_assignment("_HAVE_LKUP_LSEARCH=y"); + read_macro_assignment(US"_HAVE_LKUP_LSEARCH=y"); #endif #ifdef LOOKUP_CDB - read_macro_assignment("_HAVE_LKUP_CDB=y"); + read_macro_assignment(US"_HAVE_LKUP_CDB=y"); #endif #ifdef LOOKUP_DBM - read_macro_assignment("_HAVE_LKUP_DBM=y"); + read_macro_assignment(US"_HAVE_LKUP_DBM=y"); #endif #ifdef LOOKUP_DNSDB - read_macro_assignment("_HAVE_LKUP_DNSDB=y"); + read_macro_assignment(US"_HAVE_LKUP_DNSDB=y"); #endif #ifdef LOOKUP_DSEARCH - read_macro_assignment("_HAVE_LKUP_DSEARCH=y"); + read_macro_assignment(US"_HAVE_LKUP_DSEARCH=y"); #endif #ifdef LOOKUP_IBASE - read_macro_assignment("_HAVE_LKUP_IBASE=y"); + read_macro_assignment(US"_HAVE_LKUP_IBASE=y"); #endif #ifdef LOOKUP_LDAP - read_macro_assignment("_HAVE_LKUP_LDAP=y"); + read_macro_assignment(US"_HAVE_LKUP_LDAP=y"); #endif #ifdef EXPERIMENTAL_LMDB - read_macro_assignment("_HAVE_LKUP_LMDB=y"); + read_macro_assignment(US"_HAVE_LKUP_LMDB=y"); #endif #ifdef LOOKUP_MYSQL - read_macro_assignment("_HAVE_LKUP_MYSQL=y"); + read_macro_assignment(US"_HAVE_LKUP_MYSQL=y"); #endif #ifdef LOOKUP_NIS - read_macro_assignment("_HAVE_LKUP_NIS=y"); + read_macro_assignment(US"_HAVE_LKUP_NIS=y"); #endif #ifdef LOOKUP_NISPLUS - read_macro_assignment("_HAVE_LKUP_NISPLUS=y"); + read_macro_assignment(US"_HAVE_LKUP_NISPLUS=y"); #endif #ifdef LOOKUP_ORACLE - read_macro_assignment("_HAVE_LKUP_ORACLE=y"); + read_macro_assignment(US"_HAVE_LKUP_ORACLE=y"); #endif #ifdef LOOKUP_PASSWD - read_macro_assignment("_HAVE_LKUP_PASSWD=y"); + read_macro_assignment(US"_HAVE_LKUP_PASSWD=y"); #endif #ifdef LOOKUP_PGSQL - read_macro_assignment("_HAVE_LKUP_PGSQL=y"); + read_macro_assignment(US"_HAVE_LKUP_PGSQL=y"); #endif #ifdef LOOKUP_REDIS - read_macro_assignment("_HAVE_LKUP_REDIS=y"); + read_macro_assignment(US"_HAVE_LKUP_REDIS=y"); #endif #ifdef LOOKUP_SQLITE - read_macro_assignment("_HAVE_LKUP_SQLITE=y"); + read_macro_assignment(US"_HAVE_LKUP_SQLITE=y"); #endif #ifdef LOOKUP_TESTDB - read_macro_assignment("_HAVE_LKUP_TESTDB=y"); + read_macro_assignment(US"_HAVE_LKUP_TESTDB=y"); #endif #ifdef LOOKUP_WHOSON - read_macro_assignment("_HAVE_LKUP_WHOSON=y"); + read_macro_assignment(US"_HAVE_LKUP_WHOSON=y"); #endif #ifdef AUTH_CRAM_MD5 - read_macro_assignment("_HAVE_AUTH_CRAM_MD5=y"); + read_macro_assignment(US"_HAVE_AUTH_CRAM_MD5=y"); #endif #ifdef AUTH_CYRUS_SASL - read_macro_assignment("_HAVE_AUTH_CYRUS_SASL=y"); + read_macro_assignment(US"_HAVE_AUTH_CYRUS_SASL=y"); #endif #ifdef AUTH_DOVECOT - read_macro_assignment("_HAVE_AUTH_DOVECOT=y"); + read_macro_assignment(US"_HAVE_AUTH_DOVECOT=y"); #endif #ifdef AUTH_GSASL - read_macro_assignment("_HAVE_AUTH_GSASL=y"); + read_macro_assignment(US"_HAVE_AUTH_GSASL=y"); #endif #ifdef AUTH_HEIMDAL_GSSAPI - read_macro_assignment("_HAVE_AUTH_HEIMDAL_GSSAPI=y"); + read_macro_assignment(US"_HAVE_AUTH_HEIMDAL_GSSAPI=y"); #endif #ifdef AUTH_PLAINTEXT - read_macro_assignment("_HAVE_AUTH_PLAINTEXT=y"); + read_macro_assignment(US"_HAVE_AUTH_PLAINTEXT=y"); #endif #ifdef AUTH_SPA - read_macro_assignment("_HAVE_AUTH_SPA=y"); + read_macro_assignment(US"_HAVE_AUTH_SPA=y"); #endif #ifdef AUTH_TLS - read_macro_assignment("_HAVE_AUTH_TLS=y"); + read_macro_assignment(US"_HAVE_AUTH_TLS=y"); #endif #ifdef ROUTER_ACCEPT - read_macro_assignment("_HAVE_RTR_ACCEPT=y"); + read_macro_assignment(US"_HAVE_RTR_ACCEPT=y"); #endif #ifdef ROUTER_DNSLOOKUP - read_macro_assignment("_HAVE_RTR_DNSLOOKUP=y"); + read_macro_assignment(US"_HAVE_RTR_DNSLOOKUP=y"); #endif #ifdef ROUTER_IPLITERAL - read_macro_assignment("_HAVE_RTR_IPLITERAL=y"); + read_macro_assignment(US"_HAVE_RTR_IPLITERAL=y"); #endif #ifdef ROUTER_IPLOOKUP - read_macro_assignment("_HAVE_RTR_IPLOOKUP=y"); + read_macro_assignment(US"_HAVE_RTR_IPLOOKUP=y"); #endif #ifdef ROUTER_MANUALROUTE - read_macro_assignment("_HAVE_RTR_MANUALROUTE=y"); + read_macro_assignment(US"_HAVE_RTR_MANUALROUTE=y"); #endif #ifdef ROUTER_QUERYPROGRAM - read_macro_assignment("_HAVE_RTR_QUERYPROGRAM=y"); + read_macro_assignment(US"_HAVE_RTR_QUERYPROGRAM=y"); #endif #ifdef ROUTER_REDIRECT - read_macro_assignment("_HAVE_RTR_REDRCT=y"); + read_macro_assignment(US"_HAVE_RTR_REDRCT=y"); #endif #ifdef TRANSPORT_APPENDFILE - read_macro_assignment("_HAVE_TPT_APPENDFILE=y"); + read_macro_assignment(US"_HAVE_TPT_APPENDFILE=y"); # ifdef SUPPORT_MAILDIR - read_macro_assignment("_HAVE_TPT_APPEND_MAILDR=y"); + read_macro_assignment(US"_HAVE_TPT_APPEND_MAILDR=y"); # endif # ifdef SUPPORT_MAILSTORE - read_macro_assignment("_HAVE_TPT_APPEND_MAILSTORE=y"); + read_macro_assignment(US"_HAVE_TPT_APPEND_MAILSTORE=y"); # endif # ifdef SUPPORT_MBX - read_macro_assignment("_HAVE_TPT_APPEND_MBX=y"); + read_macro_assignment(US"_HAVE_TPT_APPEND_MBX=y"); # endif #endif #ifdef TRANSPORT_AUTOREPLY - read_macro_assignment("_HAVE_TPT_AUTOREPLY=y"); + read_macro_assignment(US"_HAVE_TPT_AUTOREPLY=y"); #endif #ifdef TRANSPORT_LMTP - read_macro_assignment("_HAVE_TPT_LMTP=y"); + read_macro_assignment(US"_HAVE_TPT_LMTP=y"); #endif #ifdef TRANSPORT_PIPE - read_macro_assignment("_HAVE_TPT_PIPE=y"); + read_macro_assignment(US"_HAVE_TPT_PIPE=y"); #endif #ifdef TRANSPORT_SMTP - read_macro_assignment("_HAVE_TPT_SMTP=y"); + read_macro_assignment(US"_HAVE_TPT_SMTP=y"); #endif } diff --git a/src/src/regex.c b/src/src/regex.c index 233a56bce..9274f9095 100644 --- a/src/src/regex.c +++ b/src/src/regex.c @@ -148,7 +148,12 @@ if (!mime_stream) else { clearerr(mime_stream); - fseek(mime_stream, f_pos, SEEK_SET); + if (fseek(mime_stream, f_pos, SEEK_SET) == -1) + { + log_write(0, LOG_MAIN|LOG_PANIC, + "regex acl condition: mime_stream: %s", strerror(errno)); + clearerr(mime_stream); + } } return ret; diff --git a/src/src/sieve.c b/src/src/sieve.c index c53db3732..e6dde77a6 100644 --- a/src/src/sieve.c +++ b/src/src/sieve.c @@ -1704,12 +1704,13 @@ Returns: 1 success -1 no string list found */ -static int parse_stringlist(struct Sieve *filter, struct String **data) +static int +parse_stringlist(struct Sieve *filter, struct String **data) { const uschar *orig=filter->pc; -int dataCapacity=0; -int dataLength=0; -struct String *d=(struct String*)0; +int dataCapacity = 0; +int dataLength = 0; +struct String *d = NULL; int m; if (*filter->pc=='[') /* string list */ @@ -1718,20 +1719,18 @@ if (*filter->pc=='[') /* string list */ for (;;) { if (parse_white(filter)==-1) goto error; - if ((dataLength+1)>=dataCapacity) /* increase buffer */ + if (dataLength+1 >= dataCapacity) /* increase buffer */ { struct String *new; int newCapacity; /* Don't amalgamate with next line; some compilers grumble */ - newCapacity=dataCapacity?(dataCapacity*=2):(dataCapacity=4); - if ((new=(struct String*)store_get(sizeof(struct String)*newCapacity))==(struct String*)0) - { - filter->errmsg=CUstrerror(errno); - goto error; - } + + dataCapacity = dataCapacity ? dataCapacity * 2 : 4; + new = store_get(sizeof(struct String) * dataCapacity); + if (d) memcpy(new,d,sizeof(struct String)*dataLength); - d=new; - dataCapacity=newCapacity; + d = new; } + m=parse_string(filter,&d[dataLength]); if (m==0) { diff --git a/src/src/spool_in.c b/src/src/spool_in.c index 915798784..1b7cee6b0 100644 --- a/src/src/spool_in.c +++ b/src/src/spool_in.c @@ -51,7 +51,7 @@ for (i = 0; i < 2; i++) uschar * fname; int save_errno; - message_subdir[0] = split_spool_directory == i == 0 ? id[5] : 0; + message_subdir[0] = split_spool_directory == i ? '\0' : id[5]; fname = spool_fname(US"input", message_subdir, id, US"-D"); DEBUG(D_deliver) debug_printf("Trying spool file %s\n", fname); @@ -476,21 +476,21 @@ for (;;) else if (Ustrncmp(p, "cl ", 3) == 0) { - int index, count; - uschar name[20]; /* Need plenty of space for %d format */ - tree_node *node; - if ( sscanf(CS big_buffer + 5, "%d %d", &index, &count) != 2 + unsigned index, count; + uschar name[20]; /* Need plenty of space for %u format */ + tree_node * node; + if ( sscanf(CS big_buffer + 5, "%u %u", &index, &count) != 2 || index >= 20 ) goto SPOOL_FORMAT_ERROR; if (index < 10) - (void) string_format(name, sizeof(name), "%c%d", 'c', index); + (void) string_format(name, sizeof(name), "%c%u", 'c', index); else - (void) string_format(name, sizeof(name), "%c%d", 'm', index - 10); + (void) string_format(name, sizeof(name), "%c%u", 'm', index - 10); node = acl_var_create(name); node->data.ptr = store_get(count + 1); if (fread(node->data.ptr, 1, count+1, f) < count) goto SPOOL_READ_ERROR; - ((uschar*)node->data.ptr)[count] = 0; + (US node->data.ptr)[count] = '\0'; } break; diff --git a/src/src/spool_mbox.c b/src/src/spool_mbox.c index 89691652e..b1de39e7d 100644 --- a/src/src/spool_mbox.c +++ b/src/src/spool_mbox.c @@ -196,7 +196,6 @@ if (spool_mbox_ok && !no_mbox_unspool) { uschar *mbox_path; uschar *file_path; - int n; struct dirent *entry; DIR *tempdir; @@ -214,11 +213,12 @@ if (spool_mbox_ok && !no_mbox_unspool) while((entry = readdir(tempdir)) != NULL) { uschar *name = US entry->d_name; + int dummy; if (Ustrcmp(name, US".") == 0 || Ustrcmp(name, US"..") == 0) continue; file_path = string_sprintf("%s/%s", mbox_path, name); debug_printf("unspool_mbox(): unlinking '%s'\n", file_path); - n = unlink(CS file_path); + dummy = unlink(CS file_path); } closedir(tempdir); diff --git a/src/src/tls-openssl.c b/src/src/tls-openssl.c index 229ea4131..64dcab600 100644 --- a/src/src/tls-openssl.c +++ b/src/src/tls-openssl.c @@ -950,11 +950,11 @@ X509_set_pubkey(x509, pkey); name = X509_get_subject_name(x509); X509_NAME_add_entry_by_txt(name, "C", - MBSTRING_ASC, "UK", -1, -1, 0); + MBSTRING_ASC, CUS "UK", -1, -1, 0); X509_NAME_add_entry_by_txt(name, "O", - MBSTRING_ASC, "Exim Developers", -1, -1, 0); + MBSTRING_ASC, CUS "Exim Developers", -1, -1, 0); X509_NAME_add_entry_by_txt(name, "CN", - MBSTRING_ASC, CS smtp_active_hostname, -1, -1, 0); + MBSTRING_ASC, CUS smtp_active_hostname, -1, -1, 0); X509_set_issuer_name(x509, name); where = US"signing cert"; diff --git a/src/src/transport.c b/src/src/transport.c index efc30be59..33f9a580a 100644 --- a/src/src/transport.c +++ b/src/src/transport.c @@ -941,7 +941,7 @@ suboptimal. */ if (tctx->options & topt_use_bdat) { off_t fsize; - int hsize, size; + int hsize, size = 0; if ((hsize = chunk_ptr - deliver_out_buffer) < 0) hsize = 0; @@ -1172,17 +1172,17 @@ else /* Send file down the original fd */ while((sread = read(dkim_fd, deliver_out_buffer, DELIVER_OUT_BUFFER_SIZE)) >0) { - char *p = deliver_out_buffer; + uschar * p = deliver_out_buffer; /* write the chunk */ while (sread) { #ifdef SUPPORT_TLS wwritten = tls_out.active == out_fd - ? tls_write(FALSE, US p, sread) - : write(out_fd, p, sread); + ? tls_write(FALSE, p, sread) + : write(out_fd, CS p, sread); #else - wwritten = write(out_fd, p, sread); + wwritten = write(out_fd, CS p, sread); #endif if (wwritten == -1) goto err; @@ -1235,7 +1235,6 @@ Returns: TRUE on success; FALSE (with errno) for any failure BOOL transport_write_message(int fd, transport_ctx * tctx, int size_limit) { -unsigned wck_flags; BOOL last_filter_was_NL = TRUE; int rc, len, yield, fd_read, fd_write, save_errno; int pfd[2] = {-1, -1}; @@ -1259,7 +1258,6 @@ if ( !transport_filter_argv before being written to the incoming fd. First set up the special processing to be done during the copying. */ -wck_flags = tctx->options & topt_use_crlf; nl_partial_match = -1; if (tctx->check_string && tctx->escape_string) @@ -1425,14 +1423,19 @@ if (write_pid > 0) { rc = child_close(write_pid, 30); if (yield) - { if (rc == 0) { BOOL ok; - int dummy = read(pfd[pipe_read], (void *)&ok, sizeof(BOOL)); - if (!ok) + if (read(pfd[pipe_read], (void *)&ok, sizeof(BOOL)) != sizeof(BOOL)) + { + DEBUG(D_transport) + debug_printf("pipe read from writing process: %s\n", strerror(errno)); + save_errno = ERRNO_FILTER_FAIL; + yield = FALSE; + } + else if (!ok) { - dummy = read(pfd[pipe_read], (void *)&save_errno, sizeof(int)); + int dummy = read(pfd[pipe_read], (void *)&save_errno, sizeof(int)); dummy = read(pfd[pipe_read], (void *)&(tctx->addr->more_errno), sizeof(int)); yield = FALSE; } @@ -1444,7 +1447,6 @@ if (write_pid > 0) tctx->addr->more_errno = rc; DEBUG(D_transport) debug_printf("writing process returned %d\n", rc); } - } } (void)close(pfd[pipe_read]); diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c index e8a675750..21c57209c 100644 --- a/src/src/transports/smtp.c +++ b/src/src/transports/smtp.c @@ -1574,7 +1574,6 @@ lflags.send_quit = TRUE; lflags.setting_up = TRUE; lflags.esmtp = TRUE; lflags.esmtp_sent = FALSE; -lflags.pending_MAIL; #ifndef DISABLE_PRDR lflags.prdr_active; #endif diff --git a/src/src/verify.c b/src/src/verify.c index 865a01d07..1ff8cd17f 100644 --- a/src/src/verify.c +++ b/src/src/verify.c @@ -808,7 +808,6 @@ can do it there for the non-rcpt-verify case. For this we keep an addresscount. int oldtimeout = ob->command_timeout; int rc; - tls_negotiate: ob->command_timeout = callout; rc = tls_client_start(inblock.sock, host, addr, addr->transport # ifdef EXPERIMENTAL_DANE