From d9d06eb58750b42fca6a13610e8d8b58445eb702 Mon Sep 17 00:00:00 2001
From: Gerhard <Gerhard>
Date: Thu, 13 Feb 2025 14:29:15 +0100
Subject: [PATCH] Fixed preprocessor directives in macro invocation

---
 CHANGES |  3 +++
 filan.c | 10 +++++-----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/CHANGES b/CHANGES
index 8d8a30b..4885be8 100644
--- a/CHANGES
+++ b/CHANGES
@@ -84,6 +84,9 @@ Corrections:
 	When IP4 was completed deconfigured, UDP6-RECVFROM with range option
 	failed.
 
+	Fixed preprocessor directives in macro invocation.
+	Thanks to Mario de Weerd for reporting this issue.
+
 Features:
 	POSIXMQ-RECV now takes option o-nonblock; this, in combination with -T,
 	makes it possible to terminate Socat in case the queue is empty.
diff --git a/filan.c b/filan.c
index 36def50..fb9229c 100644
--- a/filan.c
+++ b/filan.c
@@ -393,7 +393,7 @@ int filan_stat(
       break;
 #ifdef S_IFLNK
    case (S_IFLNK):	/* 10, symbolic link */
-      /* we wait for freadlink() sytem call */
+      /* we wait for freadlink() system call */
       break;
 #endif /* S_IFLNK */
       break;
@@ -804,13 +804,13 @@ int ipan(int fd, FILE *outfile) {
    }
    /* want to pass the fd to the next layer protocol. */
 #if defined(SO_PROTOCOL) || defined(SO_PROTOTYPE)
-   if (Getsockopt(fd, SOL_SOCKET,
+   if (
 #ifdef SO_PROTOCOL
-		  SO_PROTOCOL,
+       Getsockopt(fd, SOL_SOCKET, SO_PROTOCOL, &optproto, &optlen)
 #elif defined(SO_PROTOTYPE)
-		  SO_PROTOTYPE,
+       Getsockopt(fd, SOL_SOCKET, SO_PROTOTYPE, &optproto, &optlen)
 #endif
-		  &optproto, &optlen) >= 0) {
+       >= 0) {
       switch (optproto) {
 #if WITH_TCP
       case IPPROTO_TCP: tcpan(fd, outfile); break;