[exim-cvs] compiler quietening

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Exim Git Commits Mailing List
Ημερομηνία:  
Προς: exim-cvs
Αντικείμενο: [exim-cvs] compiler quietening
Gitweb: https://git.exim.org/exim.git/commitdiff/2be52035b61a6077c755a9838597ecf0c507aec7
Commit:     2be52035b61a6077c755a9838597ecf0c507aec7
Parent:     27193c2c75fde3b0862112925074572b135d67c6
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Wed Nov 27 20:09:34 2024 +0000
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Wed Nov 27 21:51:46 2024 +0000


    compiler quietening
---
 src/exim_monitor/em_menu.c  |  2 +-
 src/exim_monitor/em_queue.c |  3 ++-
 src/src/debug.c             | 14 ++++----------
 src/src/dns.c               |  1 +
 src/src/exim.c              |  5 +++--
 src/src/functions.h         |  5 +++++
 src/src/log.c               |  9 +++++----
 src/src/malware.c           |  3 ++-
 src/src/miscmods/perl.c     |  1 +
 src/src/readconf.c          |  1 +
 src/src/tls.c               |  5 +++--
 src/src/transport.c         | 13 +++++++------
 src/src/transports/smtp.c   |  3 ++-
 src/src/verify.c            |  2 +-
 14 files changed, 38 insertions(+), 29 deletions(-)


diff --git a/src/exim_monitor/em_menu.c b/src/exim_monitor/em_menu.c
index 03f925f52..25ab806b3 100644
--- a/src/exim_monitor/em_menu.c
+++ b/src/exim_monitor/em_menu.c
@@ -364,7 +364,7 @@ if ((pid = fork()) == 0)
dup2(pipe_fd[1], 2);
close(pipe_fd[1]);

- system(CS buffer);
+ if (system(CS buffer)) ;

close(1);
close(2);
diff --git a/src/exim_monitor/em_queue.c b/src/exim_monitor/em_queue.c
index 892b4f856..c20f238fd 100644
--- a/src/exim_monitor/em_queue.c
+++ b/src/exim_monitor/em_queue.c
@@ -163,7 +163,8 @@ uschar buffer[256];

q->next = q->prev = NULL;
q->destinations = NULL;
-Ustrncpy(q->name, name, sizeof(q->name));
+Ustrncpy(q->name, name, sizeof(q->name)-1);
+q->name[sizeof(q->name)-1] = '\0';
q->seen = TRUE;
q->frozen = FALSE;
q->dir_char = dir_char;
diff --git a/src/src/debug.c b/src/src/debug.c
index 1d48f1395..cf7e9cb0f 100644
--- a/src/src/debug.c
+++ b/src/src/debug.c
@@ -243,10 +243,7 @@ if (debug_ptr == debug_buffer)
/* Set up prefix if outputting for host checking and not debugging */

   if (host_checking && debug_selector == 0)
-    {
-    Ustrcpy(debug_ptr, US">>> ");
-    debug_ptr += 4;
-    }
+    debug_ptr = Ustpcpy(debug_ptr, US">>> ");


   debug_prefix_length = debug_ptr - debug_buffer;
   }
@@ -256,19 +253,16 @@ if (indent > 0)
   for (int i = indent >> 2; i > 0; i--)
     DEBUG(D_noutf8)
       {
-      Ustrcpy(debug_ptr, US"   !");
-      debug_ptr += 4;    /* 3 spaces + shriek */
+      debug_ptr = Ustpcpy(debug_ptr, US"   !");
       debug_prefix_length += 4;
       }
     else
       {
-      Ustrcpy(debug_ptr, US"   " UTF8_VERT_2DASH);
-      debug_ptr += 6;    /* 3 spaces + 3 UTF-8 octets */
+      debug_ptr = Ustpcpy(debug_ptr, US"   " UTF8_VERT_2DASH);
       debug_prefix_length += 6;
       }


- Ustrncpy(debug_ptr, US" ", indent &= 3);
- debug_ptr += indent;
+ debug_ptr += sprintf(CS debug_ptr, "%.*s", indent &= 3, " ");
debug_prefix_length += indent;
}

diff --git a/src/src/dns.c b/src/src/dns.c
index df6618593..199c10fda 100644
--- a/src/src/dns.c
+++ b/src/src/dns.c
@@ -1329,6 +1329,7 @@ switch (type)
     GETSHORT(priority, p);
     GETSHORT(dummy_weight, p);
     GETSHORT(port, p);
+    dummy_weight = dummy_weight;    /* stupid compiler quietening */


     /* Check the CSA version number */
     if (priority != 1) continue;
diff --git a/src/src/exim.c b/src/src/exim.c
index 2297a5edc..fc186704d 100644
--- a/src/src/exim.c
+++ b/src/src/exim.c
@@ -352,7 +352,7 @@ to disrupt whatever is going on outside the signal handler. */


if (fd < 0) return;

-(void)write(fd, process_info, process_info_len);
+if (write(fd, process_info, process_info_len) != 0) ;
(void)close(fd);
}

@@ -4625,7 +4625,8 @@ privilege by now. Before the chdir, we try to ensure that the directory exists.
 if (Uchdir(spool_directory) != 0)
   {
   (void) directory_make(spool_directory, US"", SPOOL_DIRECTORY_MODE, FALSE);
-  (void) Uchdir(spool_directory);    /*XXX maybe panic on fail? */
+  if (Uchdir(spool_directory) < 0)
+    log_write(0, LOG_MAIN|LOG_PANIC_DIE, "chdir to spool: %s", strerror(errno));
   }


/* Handle calls with the -bi option. This is a sendmail option to rebuild *the*
diff --git a/src/src/functions.h b/src/src/functions.h
index 866a7ca31..85b10714e 100644
--- a/src/src/functions.h
+++ b/src/src/functions.h
@@ -738,9 +738,14 @@ if (!is_tainted(dst) && is_tainted(src)) die_tainted(US"Ustrncpy", CUS func, lin
#endif
return US strncpy(CS dst, CCS src, n);
}
+static inline uschar * Ustpcpy(uschar * dst, const uschar * src)
+{
+return US stpcpy(CS dst, CCS src);
+}
/*XXX will likely need unchecked copy also */


+
/* Advance the string pointer given over any whitespace.
Return the next char as there's enough places using it to be useful. */

diff --git a/src/src/log.c b/src/src/log.c
index a7bc2aab7..9c143e5f3 100644
--- a/src/src/log.c
+++ b/src/src/log.c
@@ -513,7 +513,7 @@ switch (type)
   case lt_debug:
     /* and deal with the debug log (which keeps the datestamp, but does not
     update it) */
-    Ustrcpy(debuglog_name, buffer);
+    sprintf(CS debuglog_name, "%.*s", (int) sizeof(debuglog_name)-1, buffer);
     if (tag)
       {
       if (is_tainted(tag))
@@ -524,7 +524,7 @@ switch (type)
       ok2 = string_format(buffer, sizeof(buffer), "%s%s",
         debuglog_name, tag);
       if (ok2)
-        Ustrcpy(debuglog_name, buffer);
+    sprintf(CS debuglog_name, "%.*s", (int)sizeof(debuglog_name)-1, buffer);
       }
     break;


@@ -1279,7 +1279,8 @@ if (flags & LOG_PANIC)
     panic_recurseflag = FALSE;


     if (panic_save_buffer)
-      (void) write(paniclogfd, panic_save_buffer, Ustrlen(panic_save_buffer));
+      if (write(paniclogfd, panic_save_buffer, Ustrlen(panic_save_buffer)) < 0)
+    DEBUG(D_any) debug_printf("sucks");


     if (  (written_len = write_gstring_to_fd_buf(paniclogfd, g))
        != gstring_length(g))
@@ -1548,7 +1549,7 @@ debug_logging_from_spool(const uschar * filename)
 {
 if (debug_fd < 0)
   {
-  Ustrncpy(debuglog_name, filename, sizeof(debuglog_name));
+  Ustrncpy(debuglog_name, filename, sizeof(debuglog_name)-1);
   if ((debug_fd = log_open_as_exim(filename)) >= 0)
     debug_file = fdopen(debug_fd, "w");
   DEBUG(D_deliver) debug_printf("debug enabled by spoolfile\n");
diff --git a/src/src/malware.c b/src/src/malware.c
index 408e2299b..e0268ab4e 100644
--- a/src/src/malware.c
+++ b/src/src/malware.c
@@ -2178,6 +2178,7 @@ badseek:  err = errno;


       }
 #endif
+  default:    break;    /* compiler quietening */
   }    /* scanner type switch */


if (malware_daemon_ctx.sock >= 0)
@@ -2257,7 +2258,7 @@ f.enable_dollar_recipients = TRUE;

ret = malware_internal(US"*", TRUE, eml_filename, 0);

-Ustrncpy(spooled_message_id, message_id, sizeof(spooled_message_id));
+memcpy(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
diff --git a/src/src/miscmods/perl.c b/src/src/miscmods/perl.c
index aef634967..6319efdcc 100644
--- a/src/src/miscmods/perl.c
+++ b/src/src/miscmods/perl.c
@@ -179,6 +179,7 @@ call_perl_cat(gstring * yield, uschar **errstrp, uschar *name, uschar **arg)
   while (*arg != NULL) XPUSHs(newSVpv(CS (*arg++), 0));
   PUTBACK;
   items = perl_call_pv(CS name, G_SCALAR|G_EVAL);
+  items = items;    /* stupid compiler quietening */
   SPAGAIN;
   sv = POPs;
   PUTBACK;
diff --git a/src/src/readconf.c b/src/src/readconf.c
index 059a4e8f0..fbc6eab0c 100644
--- a/src/src/readconf.c
+++ b/src/src/readconf.c
@@ -3381,6 +3381,7 @@ if (f.trusted_config && Ustrcmp(filename, US"/dev/null"))
     {
     rmark r = store_mark();
     void * dummy = store_get((int)statbuf.st_size, GET_UNTAINTED);
+    dummy = dummy;    /* stupid compiler quietening */
     store_reset(r);
     }
   }
diff --git a/src/src/tls.c b/src/src/tls.c
index 5892491fc..67f0f624d 100644
--- a/src/src/tls.c
+++ b/src/src/tls.c
@@ -310,13 +310,14 @@ void
 tls_watch_discard_event(int fd)
 {
 #ifdef EXIM_HAVE_INOTIFY
-(void) read(fd, big_buffer, big_buffer_size);
+int rc = read(fd, big_buffer, big_buffer_size);
 #endif
 #ifdef EXIM_HAVE_KEVENT
 struct kevent kev;
 struct timespec t = {0};
-(void) kevent(fd, NULL, 0, &kev, 1, &t);
+int rc = kevent(fd, NULL, 0, &kev, 1, &t);
 #endif
+rc = rc;    /* stupid compiler quietening */
 }
 #endif    /*EXIM_HAVE_INOTIFY*/


diff --git a/src/src/transport.c b/src/src/transport.c
index 063fda361..81d93deeb 100644
--- a/src/src/transport.c
+++ b/src/src/transport.c
@@ -149,32 +149,32 @@ int old_pool = store_pool;
store_pool = POOL_PERM;
{
driver_info ** anchor = (driver_info **) &transports_available;
- extern transport_info appendfile_transport_info;
- extern transport_info autoreply_transport_info;
- extern transport_info lmtp_transport_info;
- extern transport_info pipe_transport_info;
- extern transport_info queuefile_transport_info;
- extern transport_info smtp_transport_info;

/* Add the transport drivers that are built for static linkage to the
list of availables. */

 #if defined(TRANSPORT_APPENDFILE) && TRANSPORT_APPENDFILE!=2
+  extern transport_info appendfile_transport_info;
   add_driver_info(anchor, &appendfile_transport_info.drinfo, sizeof(transport_info));
 #endif
 #if defined(TRANSPORT_AUTOREPLY) && TRANSPORT_AUTOREPLY!=2
+  extern transport_info autoreply_transport_info;
   add_driver_info(anchor, &autoreply_transport_info.drinfo, sizeof(transport_info));
 #endif
 #if defined(TRANSPORT_LMTP) && TRANSPORT_LMTP!=2
+  extern transport_info lmtp_transport_info;
   add_driver_info(anchor, &lmtp_transport_info.drinfo, sizeof(transport_info));
 #endif
 #if defined(TRANSPORT_PIPE) && TRANSPORT_PIPE!=2
+  extern transport_info pipe_transport_info;
   add_driver_info(anchor, &pipe_transport_info.drinfo, sizeof(transport_info));
 #endif
 #if defined(EXPERIMENTAL_QUEUEFILE) && EXPERIMENTAL_QUEUEFILE!=2
+  extern transport_info queuefile_transport_info;
   add_driver_info(anchor, &queuefile_transport_info.drinfo, sizeof(transport_info));
 #endif
 #if defined(TRANSPORT_SMTP) && TRANSPORT_SMTP!=2
+  extern transport_info smtp_transport_info;
   add_driver_info(anchor, &smtp_transport_info.drinfo, sizeof(transport_info));
 #endif
   }
@@ -1451,6 +1451,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_time, sizeof(struct timeval));
+        dummy = dummy;    /* (more) compiler quietening */
         yield = FALSE;
         }
       }
diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c
index f2038addc..2da9514d0 100644
--- a/src/src/transports/smtp.c
+++ b/src/src/transports/smtp.c
@@ -2286,7 +2286,8 @@ if (continue_hostname && continue_proxy_cipher)
             continue_proxy_sni, sni);


     smtp_debug_cmd(US"QUIT", 0);
-    write(0, "QUIT\r\n", 6);
+    if (write(0, "QUIT\r\n", 6) < 0)
+      DEBUG(D_any) debug_printf("stupid compiler\n");
     close(0);
     continue_hostname = continue_proxy_cipher = NULL;
     f.continue_more = FALSE;
diff --git a/src/src/verify.c b/src/src/verify.c
index 81f28d66e..33929e023 100644
--- a/src/src/verify.c
+++ b/src/src/verify.c
@@ -3477,7 +3477,7 @@ if ((rc = verify_address(&vaddr, NULL, vopt_is_recipient | vopt_quota,
   }


DEBUG(D_verify) debug_printf_indent("verify_quota: len %d\n", len);
-write(1, msg, len);
+if (write(1, msg, len) != 0) ;
return;
}


--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-cvs.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-cvs-unsubscribe@???
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/