[exim-cvs] cppcheck silencing

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Exim Git Commits Mailing List
Date:  
À: exim-cvs
Sujet: [exim-cvs] cppcheck silencing
Gitweb: https://git.exim.org/exim.git/commitdiff/0a2de84c8a05643d1a87b97a3a265a68ec246031
Commit:     0a2de84c8a05643d1a87b97a3a265a68ec246031
Parent:     e2730b852a7ea9504008fa85878f5304dfdbd06e
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Tue Dec 3 20:09:45 2024 +0000
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Tue Dec 3 21:41:23 2024 +0000


    cppcheck silencing
---
 src/src/acl.c       | 33 ++-------------------------------
 src/src/daemon.c    |  2 +-
 src/src/exim.c      |  2 +-
 src/src/exim_lock.c | 22 ++++++++++++++--------
 4 files changed, 18 insertions(+), 41 deletions(-)


diff --git a/src/src/acl.c b/src/src/acl.c
index 3f35a4946..882fddd3c 100644
--- a/src/src/acl.c
+++ b/src/src/acl.c
@@ -153,9 +153,7 @@ static condition_def conditions[] = {
   [ACLC_ADD_HEADER] =        { US"add_header",    ACD_EXP | ACD_MOD,
                   PERMITTED(ACL_BIT_MAIL | ACL_BIT_RCPT |
                     ACL_BIT_PREDATA | ACL_BIT_DATA |
-#ifndef DISABLE_PRDR
                     ACL_BIT_PRDR |
-#endif
                     ACL_BIT_MIME | ACL_BIT_NOTSMTP |
                     ACL_BIT_DKIM |
                     ACL_BIT_NOTSMTP_START),
@@ -175,9 +173,7 @@ static condition_def conditions[] = {
                   FORBIDDEN(ACL_BIT_AUTH |
                     ACL_BIT_CONNECT | ACL_BIT_HELO |
                     ACL_BIT_DATA | ACL_BIT_MIME |
-# ifndef DISABLE_PRDR
                     ACL_BIT_PRDR |
-# endif
                     ACL_BIT_ETRN | ACL_BIT_EXPN |
                     ACL_BIT_MAILAUTH |
                     ACL_BIT_MAIL | ACL_BIT_STARTTLS |
@@ -198,9 +194,7 @@ static condition_def conditions[] = {
 #ifdef EXPERIMENTAL_DCC
   [ACLC_DCC] =            { US"dcc",        ACD_EXP,
                   PERMITTED(ACL_BIT_DATA |
-# ifndef DISABLE_PRDR
                   ACL_BIT_PRDR |
-# endif
                   ACL_BIT_NOTSMTP),
   },
 #endif
@@ -224,9 +218,7 @@ static condition_def conditions[] = {
 # endif
                   ACD_EXP,
                   PERMITTED(ACL_BIT_DKIM | ACL_BIT_DATA | ACL_BIT_MIME
-# ifndef DISABLE_PRDR
                   | ACL_BIT_PRDR
-# endif
       ),
   },
 #endif
@@ -246,9 +238,7 @@ static condition_def conditions[] = {


   [ACLC_DOMAINS] =        { US"domains",        0,
                   PERMITTED(ACL_BIT_RCPT | ACL_BIT_VRFY
-#ifndef DISABLE_PRDR
                   | ACL_BIT_PRDR
-#endif
       ),
   },
   [ACLC_ENCRYPTED] =        { US"encrypted",    0,
@@ -265,9 +255,7 @@ static condition_def conditions[] = {
   },
   [ACLC_LOCAL_PARTS] =        { US"local_parts",    0,
                   PERMITTED(ACL_BIT_RCPT | ACL_BIT_VRFY
-#ifndef DISABLE_PRDR
                   | ACL_BIT_PRDR
-#endif
       ),
   },


@@ -281,9 +269,7 @@ static condition_def conditions[] = {
 #ifdef WITH_CONTENT_SCAN
   [ACLC_MALWARE] =        { US"malware",        ACD_EXP,
                   PERMITTED(ACL_BIT_DATA |
-# ifndef DISABLE_PRDR
                     ACL_BIT_PRDR |
-# endif
                     ACL_BIT_NOTSMTP),
   },
 #endif
@@ -297,9 +283,7 @@ static condition_def conditions[] = {


   [ACLC_QUEUE] =        { US"queue",        ACD_EXP | ACD_MOD,
                   FORBIDDEN(ACL_BIT_NOTSMTP |
-#ifndef DISABLE_PRDR
                   ACL_BIT_PRDR |
-#endif
                   ACL_BIT_DATA),
   },


@@ -311,9 +295,7 @@ static condition_def conditions[] = {
 #ifdef WITH_CONTENT_SCAN
   [ACLC_REGEX] =        { US"regex",        ACD_EXP,
                   PERMITTED(ACL_BIT_DATA |
-# ifndef DISABLE_PRDR
                     ACL_BIT_PRDR |
-# endif
                     ACL_BIT_NOTSMTP |
                     ACL_BIT_MIME),
   },
@@ -322,9 +304,7 @@ static condition_def conditions[] = {
   [ACLC_REMOVE_HEADER] =    { US"remove_header",    ACD_EXP | ACD_MOD,
                   PERMITTED(ACL_BIT_MAIL|ACL_BIT_RCPT |
                     ACL_BIT_PREDATA | ACL_BIT_DATA |
-#ifndef DISABLE_PRDR
                     ACL_BIT_PRDR |
-#endif
                     ACL_BIT_MIME | ACL_BIT_NOTSMTP |
                     ACL_BIT_NOTSMTP_START),
   },
@@ -351,9 +331,7 @@ static condition_def conditions[] = {
 #ifdef WITH_CONTENT_SCAN
   [ACLC_SPAM] =            { US"spam",        ACD_EXP,
                   PERMITTED(ACL_BIT_DATA |
-# ifndef DISABLE_PRDR
                   ACL_BIT_PRDR |
-# endif
                   ACL_BIT_NOTSMTP),
   },
 #endif
@@ -531,9 +509,7 @@ static control_def controls_list[] = {
 [CONTROL_DKIM_VERIFY] =
   { US"dkim_disable_verify",     FALSE,
                   ACL_BIT_DATA | ACL_BIT_NOTSMTP |
-# ifndef DISABLE_PRDR
                   ACL_BIT_PRDR |
-# endif
                   ACL_BIT_NOTSMTP_START
   },
 #endif
@@ -567,9 +543,7 @@ static control_def controls_list[] = {
       (unsigned)
       ~(ACL_BIT_MAIL | ACL_BIT_RCPT |
         ACL_BIT_PREDATA | ACL_BIT_DATA |
-#ifndef DISABLE_PRDR
         ACL_BIT_PRDR |
-#endif
         ACL_BIT_MIME)
   },
 [CONTROL_FAKEREJECT] =
@@ -577,9 +551,7 @@ static control_def controls_list[] = {
       (unsigned)
       ~(ACL_BIT_MAIL | ACL_BIT_RCPT |
         ACL_BIT_PREDATA | ACL_BIT_DATA |
-#ifndef DISABLE_PRDR
       ACL_BIT_PRDR |
-#endif
       ACL_BIT_MIME)
   },
 [CONTROL_FREEZE] =
@@ -2509,7 +2481,7 @@ BOOL leaky = FALSE, strict = FALSE, readonly = FALSE;
 BOOL noupdate = FALSE, badacl = FALSE;
 int mode = RATE_PER_WHAT;
 int old_pool, rc;
-tree_node **anchor, *t;
+tree_node ** anchor = NULL, * t;
 open_db dbblock, *dbm;
 int dbdb_size;
 dbdata_ratelimit *dbd;
@@ -2680,7 +2652,6 @@ else switch(mode)
     anchor = &ratelimiters_cmd;
     break;
   default:
-    anchor = NULL; /* silence an "unused" complaint */
     log_write(0, LOG_MAIN|LOG_PANIC_DIE,
       "internal ACL error: unknown ratelimit mode %d", mode);
     /*NOTREACHED*/
@@ -5215,7 +5186,7 @@ acl_standalone_setvar(const uschar * s, BOOL taint)
 {
 acl_condition_block * cond = store_get(sizeof(acl_condition_block), GET_UNTAINTED);
 uschar * errstr = NULL, * log_msg = NULL;
-BOOL endpass_seen;
+BOOL endpass_seen = FALSE;
 int e;


 cond->next = NULL;
diff --git a/src/src/daemon.c b/src/src/daemon.c
index 0c6ed4da0..e68d4dba1 100644
--- a/src/src/daemon.c
+++ b/src/src/daemon.c
@@ -1890,6 +1890,7 @@ if (f.daemon_listen && !f.inetd_wait_mode)
   if (override_local_interfaces)
     {
     gstring * new_smtp_port = NULL, * new_local_interfaces = NULL;
+    uschar joinstr[4] = {0};        /* cppcheck silencing */


     if (!override_pid_file_path) write_pid = FALSE;


@@ -1902,7 +1903,6 @@ if (f.daemon_listen && !f.inetd_wait_mode)

     for (int sep = 0; s = string_nextinlist(&list, &sep, NULL, 0); )
       {
-      uschar joinstr[4];
       gstring ** gp = Ustrpbrk(s, ".:") ? &new_local_interfaces : &new_smtp_port;
       if (!*gp)
         {
diff --git a/src/src/exim.c b/src/src/exim.c
index 7a067c03f..201bf6e8e 100644
--- a/src/src/exim.c
+++ b/src/src/exim.c
@@ -1393,7 +1393,7 @@ DEBUG(D_any)
 # ifdef __VERSION__
   g = string_fmt_append(g, "Compiler: GCC [%s]\n", __VERSION__);
 # else
-  g = string_fmt_append(g, "Compiler: GCC [%s]\n", "? unknown version ?";
+  g = string_fmt_append(g, "Compiler: GCC [%s]\n", "? unknown version ?");
 # endif
 #else
   g = string_cat(g, US"Compiler: <unknown>\n");
diff --git a/src/src/exim_lock.c b/src/src/exim_lock.c
index 070dfd780..d16d86225 100644
--- a/src/src/exim_lock.c
+++ b/src/src/exim_lock.c
@@ -337,15 +337,21 @@ for (j = 0; j < lock_retries; j++)
     /* Apply hitching post algorithm. */


     if ((rc = link(hitchname, lockname)) != 0)
-     rc2 = fstat(hd, &statbuf);
-    (void)close(hd);
-    unlink(hitchname);
-
-    if (rc != 0 && (rc2 != 0 || statbuf.st_nlink != 2))
       {
-      printf("exim_lock: failed to link hitching post to lock file\n");
-      hd = -1;
-      goto RETRY;
+      rc2 = fstat(hd, &statbuf);
+      (void)close(hd);
+      unlink(hitchname);
+      if ((rc2 != 0 || statbuf.st_nlink != 2))
+    {
+    printf("exim_lock: failed to link hitching post to lock file\n");
+    hd = -1;
+    goto RETRY;
+    }
+      }
+    else
+      {
+      (void)close(hd);
+      unlink(hitchname);
       }


     if (!quiet) printf("exim_lock: lock file successfully created\n");


--
## 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/