Apply correct casts to check_ext_mail and check_ext_mail_status

As always, the funcion pointers should be cast to the correct type before calling them, rather
than calling them with the wrong type and trying to cast the result.  Fixes a warning compiling
mail.c on 64 bit architectures, and this might well have caused a crash when using the qmail plugin
on those architectures too.
This commit is contained in:
Kevin Easton
2016-11-03 00:53:33 +11:00
parent 414b1cc679
commit 966f1c6c27
2 changed files with 8 additions and 4 deletions

View File

@@ -1,5 +1,9 @@
[Changes 1.2.2] [Changes 1.2.2]
* Cast check_ext_mail and check_ext_mail_status function pointers to the
correct type before using them. This might have caused a problem with
the qmail plugin on 64 bit architectures. (caf)
* Fix bug in DCC privileged port detection logic. (caf) * Fix bug in DCC privileged port detection logic. (caf)
* Don't show DCC "Handshake failed" message twice, improve the message itself * Don't show DCC "Handshake failed" message twice, improve the message itself

View File

@@ -87,8 +87,8 @@ int count_maildir_mail(void)
#ifdef WANT_DLL #ifdef WANT_DLL
#define check_ext_mail global_table[CHECK_EXT_MAIL] #define check_ext_mail ((char *(*)(void))global_table[CHECK_EXT_MAIL])
#define check_ext_mail_status global_table[CHECK_EXT_MAIL_STATUS] #define check_ext_mail_status ((int (*)(void))global_table[CHECK_EXT_MAIL_STATUS])
#endif #endif
/* /*
@@ -111,7 +111,7 @@ static time_t old_stat = 0;
struct stat stat_buf; struct stat stat_buf;
#endif #endif
#ifdef WANT_DLL #ifdef WANT_DLL
if (check_ext_mail) if (check_ext_mail_status)
return (*check_ext_mail_status)(); return (*check_ext_mail_status)();
#endif #endif
if (!get_int_var(MAIL_VAR)) if (!get_int_var(MAIL_VAR))
@@ -182,7 +182,7 @@ static char ret_str[12];
static int i = 0; static int i = 0;
#ifdef WANT_DLL #ifdef WANT_DLL
if (check_ext_mail) if (check_ext_mail)
return (char *)(*check_ext_mail)(); return (*check_ext_mail)();
#endif #endif
switch (get_int_var(MAIL_VAR)) switch (get_int_var(MAIL_VAR))
{ {