pdp 2010/06/07 01:12:42 BST
Modified files:
exim-src/src buildconfig.c exim.c malware.c readconf.c
rfc2047.c tls-openssl.c
exim-src/src/transports appendfile.c
Log:
Clean up compiler warnings from { gcc -Wall }, many of which I introduced with
the ClamAV and openssl_options patches in this release.
Logic in buildconfig.c for adjusting some print format strings assumed that
long ints were four bytes; adjust to test this against reality, to remove
spurious warnings on my dev box (FreeBSD/amd64).
Note: this commit adds a buildconfig.h dependency upon inttypes.h, which was in
SUSv2, so should be safe.
Revision Changes Path
1.17 +23 -2 exim/exim-src/src/buildconfig.c
1.71 +2 -2 exim/exim-src/src/exim.c
1.21 +11 -12 exim/exim-src/src/malware.c
1.41 +0 -1 exim/exim-src/src/readconf.c
1.6 +1 -1 exim/exim-src/src/rfc2047.c
1.27 +20 -20 exim/exim-src/src/tls-openssl.c
1.27 +1 -1 exim/exim-src/src/transports/appendfile.c
Index: buildconfig.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/buildconfig.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- buildconfig.c 6 Jun 2010 02:46:13 -0000 1.16
+++ buildconfig.c 7 Jun 2010 00:12:42 -0000 1.17
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/buildconfig.c,v 1.16 2010/06/06 02:46:13 pdp Exp $ */
+/* $Cambridge: exim/exim-src/src/buildconfig.c,v 1.17 2010/06/07 00:12:42 pdp Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -34,6 +34,7 @@
#include <ctype.h>
+#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -103,6 +104,9 @@
{
off_t test_off_t = 0;
time_t test_time_t = 0;
+size_t test_size_t = 0;
+unsigned long test_ulong_t = 0L;
+long test_long_t = 0;
FILE *base;
FILE *new;
int last_initial = 'A';
@@ -145,7 +149,7 @@
This assumption is known to be OK for the common operating systems. */
fprintf(new, "#ifndef OFF_T_FMT\n");
-if (sizeof(test_off_t) > 4)
+if (sizeof(test_off_t) > sizeof(test_long_t))
{
fprintf(new, "#define OFF_T_FMT \"%%lld\"\n");
fprintf(new, "#define LONGLONG_T long long int\n");
@@ -163,7 +167,7 @@
off_t. */
fprintf(new, "#ifndef TIME_T_FMT\n");
-if (sizeof(test_time_t) > 4)
+if (sizeof(test_time_t) > sizeof(test_long_t))
{
fprintf(new, "#define TIME_T_FMT \"%%lld\"\n");
fprintf(new, "#undef LONGLONG_T\n");
@@ -175,6 +179,23 @@
}
fprintf(new, "#endif\n\n");
+/* And for sizeof() results, size_t, which should with C99 be just %zu, deal
+with C99 not being ubiquitous yet. Unfortunately. */
+
+#if __STDC_VERSION__ >= 199901L
+fprintf(new, "#define SIZE_T_FMT \"%%zu\"\n");
+#else
+/*# ifdef PRIdMAX */
+#if 0
+fprintf(new, "#define SIZE_T_FMT \"%%" PRIdMAX "\"\n");
+# else
+if (sizeof(test_size_t) > sizeof (test_ulong_t))
+ fprintf(new, "#define SIZE_T_FMT \"%%llu\"\n");
+else
+ fprintf(new, "#define SIZE_T_FMT \"%%lu\"\n");
+# endif
+#endif
+
/* Now search the makefile for certain settings */
base = fopen("Makefile", "rb");
Index: exim.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/exim.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -r1.70 -r1.71
--- exim.c 6 Jun 2010 22:46:34 -0000 1.70
+++ exim.c 7 Jun 2010 00:12:42 -0000 1.71
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/exim.c,v 1.70 2010/06/06 22:46:34 pdp Exp $ */
+/* $Cambridge: exim/exim-src/src/exim.c,v 1.71 2010/06/07 00:12:42 pdp Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -905,7 +905,7 @@
fprintf(f, "%d\n", (unsigned int)fixed_never_users[i]);
}
-fprintf(f, "Size of off_t: %d\n", sizeof(off_t));
+fprintf(f, "Size of off_t: " SIZE_T_FMT "\n", sizeof(off_t));
/* This runtime check is to help diagnose library linkage mismatches which
result in segfaults and the like; as such, it's left until the end,
@@ -1570,7 +1570,7 @@
else if (Ustrcmp(argrest, "version") == 0)
{
switchchar = 'b';
- argrest = "V";
+ argrest = US"V";
}
}
Index: malware.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/malware.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- malware.c 6 Jun 2010 22:46:34 -0000 1.20
+++ malware.c 7 Jun 2010 00:12:42 -0000 1.21
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/malware.c,v 1.20 2010/06/06 22:46:34 pdp Exp $ */
+/* $Cambridge: exim/exim-src/src/malware.c,v 1.21 2010/06/07 00:12:42 pdp Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -106,23 +106,23 @@
uschar message_id_buf[64];
int ret;
- scan_options[0] = "*";
+ scan_options[0] = US"*";
scan_options[1] = NULL;
/* spool_mbox() assumes various parameters exist, when creating
the relevant directory and the email within */
(void) string_format(message_id_buf, sizeof(message_id_buf),
- US"dummy-%d", pseudo_random_number(INT_MAX));
+ "dummy-%d", pseudo_random_number(INT_MAX));
message_id = message_id_buf;
- sender_address = "malware-sender@???";
- return_path = "";
+ sender_address = US"malware-sender@???";
+ return_path = US"";
recipients_list = NULL;
- receive_add_recipient("malware-victim@???", -1);
+ receive_add_recipient(US"malware-victim@???", -1);
enable_dollar_recipients = TRUE;
ret = malware_internal(scan_options, eml_filename, TRUE);
- strncpy(spooled_message_id, message_id, sizeof(spooled_message_id));
+ Ustrncpy(spooled_message_id, message_id, sizeof(spooled_message_id));
spool_mbox_ok = 1;
/* don't set no_mbox_unspool; at present, there's no way for it to become
set, but if that changes, then it should apply to these tests too */
@@ -891,7 +891,7 @@
log_write(0, LOG_MAIN|LOG_PANIC,
"malware filename does not fit in buffer [malware_internal() kavdaemon]");
}
- p = strrchr(scanrequest, '/');
+ p = Ustrrchr(scanrequest, '/');
if (p)
*p = '\0';
@@ -1098,7 +1098,7 @@
"malware filename does not fit in buffer [malware_internal() cmdline]");
return DEFER;
}
- p = strrchr(eml_filename, '/');
+ p = Ustrrchr(eml_filename, '/');
if (p)
*p = '\0';
fits = string_format(commandline, sizeof(commandline), CS cmdline_scanner, file_name);
@@ -1199,7 +1199,6 @@
struct sockaddr_un server;
int sock, len;
uschar *p;
- BOOL fits;
uschar file_name[1024];
uschar av_buffer[1024];
@@ -1236,7 +1235,7 @@
return DEFER;
}
memcpy(file_name, eml_filename, len);
- p = strrchr(file_name, '/');
+ p = Ustrrchr(file_name, '/');
if (p)
*p = '\0';
@@ -1311,12 +1310,12 @@
uschar clamd_options2_buffer[1024];
uschar clamd_options2_default[] = "";
uschar *clamav_fbuf;
- uschar scanrequest[1024];
- int sockData, clam_fd, result;
+ int clam_fd, result;
unsigned int fsize;
BOOL use_scan_command, fits;
#ifdef WITH_OLD_CLAMAV_STREAM
uschar av_buffer2[1024];
+ int sockData;
#else
uint32_t send_size, send_final_zeroblock;
#endif
Index: readconf.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/readconf.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- readconf.c 5 Jun 2010 09:10:10 -0000 1.40
+++ readconf.c 7 Jun 2010 00:12:42 -0000 1.41
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/readconf.c,v 1.40 2010/06/05 09:10:10 pdp Exp $ */
+/* $Cambridge: exim/exim-src/src/readconf.c,v 1.41 2010/06/07 00:12:42 pdp Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -2751,7 +2751,6 @@
readconf_main(void)
{
int sep = 0;
-long dummy_l;
struct stat statbuf;
uschar *s, *filename;
uschar *list = config_main_filelist;
Index: rfc2047.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/rfc2047.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- rfc2047.c 16 Nov 2009 19:50:37 -0000 1.5
+++ rfc2047.c 7 Jun 2010 00:12:42 -0000 1.6
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/rfc2047.c,v 1.5 2009/11/16 19:50:37 nm4 Exp $ */
+/* $Cambridge: exim/exim-src/src/rfc2047.c,v 1.6 2010/06/07 00:12:42 pdp Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -279,7 +279,7 @@
else
{
DEBUG(D_any) debug_printf("iconv error translating \"%.*s\" to %s: "
- "%s\n", endword + 2 - mimeword, mimeword, target, strerror(errno));
+ "%s\n", (int)(endword + 2 - mimeword), mimeword, target, strerror(errno));
}
}
Index: tls-openssl.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/tls-openssl.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- tls-openssl.c 5 Jun 2010 10:34:29 -0000 1.26
+++ tls-openssl.c 7 Jun 2010 00:12:42 -0000 1.27
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/tls-openssl.c,v 1.26 2010/06/05 10:34:29 pdp Exp $ */
+/* $Cambridge: exim/exim-src/src/tls-openssl.c,v 1.27 2010/06/07 00:12:42 pdp Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -360,7 +360,7 @@
okay = tls_openssl_options_parse(openssl_options, &init_options);
if (!okay)
- return tls_error("openssl_options parsing failed", host, NULL);
+ return tls_error(US"openssl_options parsing failed", host, NULL);
if (init_options)
{
@@ -1179,61 +1179,61 @@
static struct exim_openssl_option exim_openssl_options[] = {
/* KEEP SORTED ALPHABETICALLY! */
#ifdef SSL_OP_ALL
- { "all", SSL_OP_ALL },
+ { US"all", SSL_OP_ALL },
#endif
#ifdef SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION
- { "allow_unsafe_legacy_renegotiation", SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION },
+ { US"allow_unsafe_legacy_renegotiation", SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION },
#endif
#ifdef SSL_OP_CIPHER_SERVER_PREFERENCE
- { "cipher_server_preference", SSL_OP_CIPHER_SERVER_PREFERENCE },
+ { US"cipher_server_preference", SSL_OP_CIPHER_SERVER_PREFERENCE },
#endif
#ifdef SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS
- { "dont_insert_empty_fragments", SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS },
+ { US"dont_insert_empty_fragments", SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS },
#endif
#ifdef SSL_OP_EPHEMERAL_RSA
- { "ephemeral_rsa", SSL_OP_EPHEMERAL_RSA },
+ { US"ephemeral_rsa", SSL_OP_EPHEMERAL_RSA },
#endif
#ifdef SSL_OP_LEGACY_SERVER_CONNECT
- { "legacy_server_connect", SSL_OP_LEGACY_SERVER_CONNECT },
+ { US"legacy_server_connect", SSL_OP_LEGACY_SERVER_CONNECT },
#endif
#ifdef SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER
- { "microsoft_big_sslv3_buffer", SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER },
+ { US"microsoft_big_sslv3_buffer", SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER },
#endif
#ifdef SSL_OP_MICROSOFT_SESS_ID_BUG
- { "microsoft_sess_id_bug", SSL_OP_MICROSOFT_SESS_ID_BUG },
+ { US"microsoft_sess_id_bug", SSL_OP_MICROSOFT_SESS_ID_BUG },
#endif
#ifdef SSL_OP_MSIE_SSLV2_RSA_PADDING
- { "msie_sslv2_rsa_padding", SSL_OP_MSIE_SSLV2_RSA_PADDING },
+ { US"msie_sslv2_rsa_padding", SSL_OP_MSIE_SSLV2_RSA_PADDING },
#endif
#ifdef SSL_OP_NETSCAPE_CHALLENGE_BUG
- { "netscape_challenge_bug", SSL_OP_NETSCAPE_CHALLENGE_BUG },
+ { US"netscape_challenge_bug", SSL_OP_NETSCAPE_CHALLENGE_BUG },
#endif
#ifdef SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG
- { "netscape_reuse_cipher_change_bug", SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG },
+ { US"netscape_reuse_cipher_change_bug", SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG },
#endif
#ifdef SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION
- { "no_session_resumption_on_renegotiation", SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION },
+ { US"no_session_resumption_on_renegotiation", SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION },
#endif
#ifdef SSL_OP_SINGLE_DH_USE
- { "single_dh_use", SSL_OP_SINGLE_DH_USE },
+ { US"single_dh_use", SSL_OP_SINGLE_DH_USE },
#endif
#ifdef SSL_OP_SINGLE_ECDH_USE
- { "single_ecdh_use", SSL_OP_SINGLE_ECDH_USE },
+ { US"single_ecdh_use", SSL_OP_SINGLE_ECDH_USE },
#endif
#ifdef SSL_OP_SSLEAY_080_CLIENT_DH_BUG
- { "ssleay_080_client_dh_bug", SSL_OP_SSLEAY_080_CLIENT_DH_BUG },
+ { US"ssleay_080_client_dh_bug", SSL_OP_SSLEAY_080_CLIENT_DH_BUG },
#endif
#ifdef SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG
- { "sslref2_reuse_cert_type_bug", SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG },
+ { US"sslref2_reuse_cert_type_bug", SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG },
#endif
#ifdef SSL_OP_TLS_BLOCK_PADDING_BUG
- { "tls_block_padding_bug", SSL_OP_TLS_BLOCK_PADDING_BUG },
+ { US"tls_block_padding_bug", SSL_OP_TLS_BLOCK_PADDING_BUG },
#endif
#ifdef SSL_OP_TLS_D5_BUG
- { "tls_d5_bug", SSL_OP_TLS_D5_BUG },
+ { US"tls_d5_bug", SSL_OP_TLS_D5_BUG },
#endif
#ifdef SSL_OP_TLS_ROLLBACK_BUG
- { "tls_rollback_bug", SSL_OP_TLS_ROLLBACK_BUG },
+ { US"tls_rollback_bug", SSL_OP_TLS_ROLLBACK_BUG },
#endif
};
static int exim_openssl_options_size =
Index: appendfile.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/transports/appendfile.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- appendfile.c 29 May 2010 12:11:48 -0000 1.26
+++ appendfile.c 7 Jun 2010 00:12:42 -0000 1.27
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/transports/appendfile.c,v 1.26 2010/05/29 12:11:48 pdp Exp $ */
+/* $Cambridge: exim/exim-src/src/transports/appendfile.c,v 1.27 2010/06/07 00:12:42 pdp Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -2073,7 +2073,7 @@
goto RETURN;
}
- if (lstat(mbx_lockname, &lstatbuf) < 0)
+ if (Ulstat(mbx_lockname, &lstatbuf) < 0)
{
addr->basic_errno = ERRNO_LOCKFAILED;
addr->message = string_sprintf("attempting to lstat open MBX "