]> git.proxmox.com Git - pve-firewall.git/blobdiff - src/pvefw-logger.c
add compile time test for log struct size
[pve-firewall.git] / src / pvefw-logger.c
index 31218a29f91d56d7d06bd59474e96532e857bc59..3a069f1e1c4c4f7e868a3a2fe7cba64cfb031860 100644 (file)
@@ -73,7 +73,7 @@ Example:
 #define PIDFILE "/var/run/pvefw-logger.pid"
 
 #define LQ_LEN 512
-#define LE_MAX (512 - 16) // try to fit into 512 bytes
+#define LE_MAX (512 - 4) // try to fit into 512 bytes
 
 #define MAX_CHAIN_LEN 28
 
@@ -82,6 +82,11 @@ struct log_entry {
     char buf[LE_MAX];
 };
 
+#define STATIC_ASSERT(cond) \
+    extern void pve_static_assert(int test[(cond) ? 1 : -1])
+
+STATIC_ASSERT(sizeof(struct log_entry) == 512);
+
 int outfd = -1;
 
 gboolean terminate_threads = FALSE;