From 12215d491664fab5e11d359edc70dcda513cc1f2 Mon Sep 17 00:00:00 2001
From: Calvin Hill <calvin@hakobaito.co.uk>
Date: Sun, 13 Jan 2019 00:39:39 +0000
Subject: Fix build of fuzztests.


diff --git a/suite/fuzz/driverbin.c b/suite/fuzz/driverbin.c
index c5676dd..1ac5b72 100644
--- a/suite/fuzz/driverbin.c
+++ b/suite/fuzz/driverbin.c
@@ -3,6 +3,7 @@
 #include <stdio.h>
 #include <dirent.h>
 #include <unistd.h>
+#include <sys/stat.h>
 
 int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size);
 const char * cs_fuzz_arch(uint8_t arch);
@@ -14,6 +15,7 @@ int main(int argc, char** argv)
     size_t Size;
     DIR *d;
     struct dirent *dir;
+    struct stat s;
     int r = 0;
     int i;
 
@@ -34,10 +36,16 @@ int main(int argc, char** argv)
 
     while((dir = readdir(d)) != NULL) {
         //opens the file, get its size, and reads it into a buffer
+        #ifndef __HAIKU__
         if (dir->d_type != DT_REG) {
             continue;
         }
-
+        else
+            stat(dir->d_name, &s);
+        if(!S_ISREG(s.st_mode)){
+            continue;
+        }
+        #endif
         printf("Running %s\n", dir->d_name);
         fflush(stdout);
 
-- 
2.26.0

