From: Marc Haber <mh+debian-packages@zugschlus.de>
Date: Wed, 18 Jun 2025 20:54:14 +0200
Subject: do not use log as a variable name

---
 Source/configuration.c |  4 ++--
 Source/filter.c        |  2 +-
 Source/icmp.c          |  6 +++---
 Source/ippl.y          |  4 ++--
 Source/log.c           |  4 ++--
 Source/main.c          | 24 ++++++++++++------------
 Source/netutils.c      |  2 +-
 Source/tcp.c           |  6 +++---
 Source/udp.c           |  6 +++---
 9 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/Source/configuration.c b/Source/configuration.c
index 20391f0..850ecce 100644
--- a/Source/configuration.c
+++ b/Source/configuration.c
@@ -39,11 +39,11 @@ int yyparse(void);
 
 FILE *open_configuration(char *name) {
   FILE *configfile;
-  extern struct loginfo log;
+  extern struct loginfo logi;
 
   configfile = fopen(name, "r");
   if (configfile == NULL) {
-    log.log(log.level_or_fd, "Cannot open configuration file %s.\n", name);
+    logi.log(logi.level_or_fd, "Cannot open configuration file %s.\n", name);
     exit(1);
   }
   return configfile;
diff --git a/Source/filter.c b/Source/filter.c
index 294568b..ff8a0fd 100644
--- a/Source/filter.c
+++ b/Source/filter.c
@@ -39,7 +39,7 @@ struct filter_entry *filter = NULL;
 
 #ifdef FILTER_DEBUG
 #include "log.h"
-extern struct loginfo log;
+extern struct loginfo logi;
 #endif
 
 /* Configuration variables */
diff --git a/Source/icmp.c b/Source/icmp.c
index d003dae..3395eb2 100644
--- a/Source/icmp.c
+++ b/Source/icmp.c
@@ -46,7 +46,7 @@
 int icmp_socket;
 
 struct loginfo icmp_log;
-extern struct loginfo log;
+extern struct loginfo logi;
 extern unsigned short resolve_protocols;
 
 /*
@@ -299,7 +299,7 @@ void *log_icmp(void *nobody) {
   icmp_socket = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
   if (icmp_socket <= 0) {
 	int error = errno;
-    	log.log(log.level_or_fd, "FATAL: Unable to open icmp raw socket\nERROR No: %d\nERROR : %s", error, strerror(error));
+    	logi.log(logi.level_or_fd, "FATAL: Unable to open icmp raw socket\nERROR No: %d\nERROR : %s", error, strerror(error));
     exit(1);
   }
 
@@ -311,7 +311,7 @@ void *log_icmp(void *nobody) {
 
   for(;;) {
     if (read(icmp_socket, (__u8 *) &pkt, ICMP_CAPTURE_LENGTH) == -1) {
-	  log.log(log.level_or_fd, "FATAL: Unable to read icmp raw socket");
+	  logi.log(logi.level_or_fd, "FATAL: Unable to read icmp raw socket");
 	  exit(1);
 	}
 
diff --git a/Source/ippl.y b/Source/ippl.y
index e74c46f..f13d7fe 100644
--- a/Source/ippl.y
+++ b/Source/ippl.y
@@ -535,7 +535,7 @@ void yyerror(char *s) {
  */
 
 void print_error(char *s, int l) {
-  extern struct loginfo log;
+  extern struct loginfo logi;
 
-  log.log(log.level_or_fd, "CFG: Parse error line %d: %s",l,s);
+  logi.log(logi.level_or_fd, "CFG: Parse error line %d: %s",l,s);
 }
diff --git a/Source/log.c b/Source/log.c
index 5d26180..6459de4 100644
--- a/Source/log.c
+++ b/Source/log.c
@@ -32,7 +32,7 @@
 
 #include "log.h"
 
-extern struct loginfo log;
+extern struct loginfo logi;
 
 /* Mutex either for stdout or for a file */
 pthread_mutex_t log_mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -193,7 +193,7 @@ void file_open(int *fd, const char *filename) {
 
   *fd = open((const char *) filename, O_WRONLY | O_APPEND | O_CREAT, 0640);
   if (*fd == 0) {
-    log.log(log.level_or_fd, "Can't open log file %s.", filename);
+    logi.log(logi.level_or_fd, "Can't open log file %s.", filename);
   }
 }
 
diff --git a/Source/main.c b/Source/main.c
index ad3fc54..fee0242 100644
--- a/Source/main.c
+++ b/Source/main.c
@@ -53,7 +53,7 @@
 #endif
 
 /* Logging mechanism */
-struct loginfo log;
+struct loginfo logi;
 
 /* Do we have to run as a daemon? */
 int run_as_daemon = TRUE;
@@ -126,17 +126,17 @@ void start_all_threads() {
   
   account = getpwnam(used_user);
   if (!account) {
-    log.log(log.level_or_fd, "WARNING: I cannot find the \"%s\" account. Not spawning threads.", used_user);
+    logi.log(logi.level_or_fd, "WARNING: I cannot find the \"%s\" account. Not spawning threads.", used_user);
     log_protocols = NONE;
     return;
   }
 
   if (!strcmp(used_user, "root")) {
-    log.log(log.level_or_fd, "WARNING: Using root account to run threads!");
+    logi.log(logi.level_or_fd, "WARNING: Using root account to run threads!");
   }
 
   if (log_protocols == NONE) {
-    log.log(log.level_or_fd, "WARNING: Nothing to log.");
+    logi.log(logi.level_or_fd, "WARNING: Nothing to log.");
     return;
   }
       
@@ -308,7 +308,7 @@ void go_background() {
 
   /* Check PID */
   if (check_pid(PID_FILE)) {
-    log.log(log.level_or_fd, "Already running. Exiting...");
+    logi.log(logi.level_or_fd, "Already running. Exiting...");
     exit(1);
   }
 
@@ -322,7 +322,7 @@ void go_background() {
 
   /* Write PID file */
   if (!write_pid(PID_FILE)) {
-    log.log(log.level_or_fd, "Can't write pid.\n");
+    logi.log(logi.level_or_fd, "Can't write pid.\n");
     exit(1);
   }
 
@@ -359,7 +359,7 @@ void die(int sig) {
     (void) remove_pid(PID_FILE);
   }
 
-  log.log(log.level_or_fd, "IP Protocols Logger: stopped (signal %d).", sig);
+  logi.log(logi.level_or_fd, "IP Protocols Logger: stopped (signal %d).", sig);
 
   exit(0);
 }
@@ -371,8 +371,8 @@ void die(int sig) {
  */
 void sighup(int sig) {
   // DEPRECATED - reload_configuration();
-  // log.log(log.level_or_fd, "IP Protocols Logger: reloaded configuration.");
-  log.log(log.level_or_fd, "IP Protocols Logger: reload configuration is unsupported.");
+  // logi.log(logi.level_or_fd, "IP Protocols Logger: reloaded configuration.");
+  logi.log(logi.level_or_fd, "IP Protocols Logger: reload configuration is unsupported.");
   die(sig);
   signal(SIGHUP, sighup);
 }
@@ -411,15 +411,15 @@ int main(int argc, char **argv) {
   if (configuration_file == NULL)
     configuration_file = strdup(CONFIGURATION_FILE);
 
-  init_loginfo(&log);
-  log.open(&log.level_or_fd, log.file);
+  init_loginfo(&logi);
+  logi.open(&logi.level_or_fd, logi.file);
 
   if (run_as_daemon) {
     go_background();
   }
 
   start_all_threads();
-  log.log(log.level_or_fd, "IP Protocols Logger: started.");
+  logi.log(logi.level_or_fd, "IP Protocols Logger: started.");
 
   for(;;) {
     sleep(dns_expire);
diff --git a/Source/netutils.c b/Source/netutils.c
index 6b8c023..84ec169 100644
--- a/Source/netutils.c
+++ b/Source/netutils.c
@@ -34,7 +34,7 @@
 #include "netutils.h"
 #include "log.h"
 
-extern struct loginfo log;
+extern struct loginfo logi;
 
 /* Mutexes */
 pthread_mutex_t service_mutex = PTHREAD_MUTEX_INITIALIZER;
diff --git a/Source/tcp.c b/Source/tcp.c
index cb43270..5821629 100644
--- a/Source/tcp.c
+++ b/Source/tcp.c
@@ -51,7 +51,7 @@
 int tcp_socket;
 
 struct loginfo tcp_log;
-extern struct loginfo log;
+extern struct loginfo logi;
 extern unsigned short resolve_protocols;
 extern unsigned short portresolve_protocols;
 
@@ -262,7 +262,7 @@ void *log_tcp(void *nobody) {
   tcp_socket = socket(AF_INET, SOCK_RAW, IPPROTO_TCP);
   if (tcp_socket <= 0) {
   	int error = errno;
-	log.log(log.level_or_fd, "FATAL: Unable to open tcp raw socket\nERROR No: %d\nERROR : %s", error, strerror(error));
+	logi.log(logi.level_or_fd, "FATAL: Unable to open tcp raw socket\nERROR No: %d\nERROR : %s", error, strerror(error));
     exit(1);
   }
 
@@ -274,7 +274,7 @@ void *log_tcp(void *nobody) {
 
   for(;;) {
     if (read(tcp_socket, (__u8 *) &pkt, TCP_CAPTURE_LENGTH) == -1) {
-	  log.log(log.level_or_fd, "FATAL: Unable to read tcp raw socket");
+	  logi.log(logi.level_or_fd, "FATAL: Unable to read tcp raw socket");
       exit(1);
 	}
 
diff --git a/Source/udp.c b/Source/udp.c
index f64e086..e0801d5 100644
--- a/Source/udp.c
+++ b/Source/udp.c
@@ -48,7 +48,7 @@ int udp_socket;
 extern unsigned short resolve_protocols;
 
 struct loginfo udp_log;
-extern struct loginfo log;
+extern struct loginfo logi;
 
 /*
  * Structure of a UDP packet
@@ -141,7 +141,7 @@ void *log_udp(void *nobody) {
   udp_socket = socket(AF_INET, SOCK_RAW, IPPROTO_UDP);
   if (udp_socket <= 0) {
   	int error = errno;
-	log.log(log.level_or_fd, "FATAL: Unable to open udp raw socket\nERROR No: %d\nERROR : %s", error, strerror(error));
+	logi.log(logi.level_or_fd, "FATAL: Unable to open udp raw socket\nERROR No: %d\nERROR : %s", error, strerror(error));
     exit(1);
   }
 
@@ -153,7 +153,7 @@ void *log_udp(void *nobody) {
 
   for(;;) {
     if (read(udp_socket, (__u8 *) &pkt, UDP_CAPTURE_LENGTH) == -1) {
-	  log.log(log.level_or_fd, "FATAL: Unable to read udp raw socket");
+	  logi.log(logi.level_or_fd, "FATAL: Unable to read udp raw socket");
       exit(1);
 	}
 
