From 13055a1ae4e14f381778e901614984f2dd95fbd4 Mon Sep 17 00:00:00 2001
From: Alam Ed Arias <alam@srb2.org>
Date: Thu, 26 Oct 2023 13:15:36 +0000
Subject: [PATCH] Update filesrch.c

Check if S_ISLNK is defined, if not, skip symlink code
---
 src/filesrch.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/filesrch.c b/src/filesrch.c
index 9977d69c3..3b6abdf88 100644
--- a/src/filesrch.c
+++ b/src/filesrch.c
@@ -23,6 +23,11 @@
 #include <windows.h>
 #endif
 #include <sys/stat.h>
+
+#ifndef S_ISLNK
+#define IGNORE_SYMLINKS
+#endif
+
 #ifndef IGNORE_SYMLINKS
 #include <unistd.h>
 #include <libgen.h>
@@ -467,8 +472,10 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
 					else
 						strcpy(filename,dent->d_name);
 #ifndef IGNORE_SYMLINKS
-					if (lstat(filename, &statbuf) != -1) {
-						if (S_ISLNK(statbuf.st_mode)) {
+					if (lstat(filename, &statbuf) != -1)
+					{
+						if (S_ISLNK(statbuf.st_mode))
+						{
 							char *tempbuf = realpath(filename, NULL);
 							if (!tempbuf)
 								I_Error("Error parsing link %s: %s", filename, strerror(errno));