[exim] Exim 4.89 compile warning on Ubuntu 14.04

Top Page
Delete this message
Reply to this message
Author: Michael J. Tubby B.Sc. MIET
Date:  
To: exim-users
Subject: [exim] Exim 4.89 compile warning on Ubuntu 14.04
Phil Pennock has just posted the availability of 4.89 release to
exim-announce.

I've downloaded and compiled on Ubuntu 14.04.5 and get one warning
during compilation:

gcc drtables.c
gcc enq.c
gcc exim.c
exim.c: In function ‘usr1_handler’:
exim.c:235:1: warning: ignoring return value of ‘write’, declared with
attribute warn_unused_result [-Wunused-result]
(void)write(fd, process_info, process_info_len);
^
gcc expand.c
gcc filter.c
gcc filtertest.c
gcc globals.c
gcc dkim.c


and believing that cleanliness is next to godliness have fixed the
warning by removing the (void) cast over the write function and
assigning the return value to variable 'sz'.

My version of usr1_handler() is provided below in 1TBS style and allows
Exim to compile without warning on Ubuntu systems:


static void usr1_handler(int sig)
{
int fd;
ssize_t sz;

os_restarting_signal(sig, usr1_handler);

fd = Uopen(process_log_path, O_APPEND|O_WRONLY, LOG_MODE);

   if (fd < 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
     root, do the creation in an exim:exim subprocess. */


     int euid = geteuid();
     if (euid == exim_uid)
       fd = Uopen(process_log_path, O_CREAT|O_APPEND|O_WRONLY, LOG_MODE);
     else if (euid == root_uid)
       fd = log_create_as_exim(process_log_path);
   }


/* If we are neither exim nor root, or if we failed to create the log
file,
give up. There is not much useful we can do with errors, since we
don't want
to disrupt whatever is going on outside the signal handler. */

   if (fd < 0)
     return;


sz = write(fd, process_info, process_info_len);
close(fd);
}



Mike