about summary refs log tree commit diff
path: root/src/afl-showmap.c
diff options
context:
space:
mode:
authorhexcoder- <heiko@hexco.de>2020-02-08 18:11:57 +0100
committerhexcoder- <heiko@hexco.de>2020-02-08 18:11:57 +0100
commit312732bdbe50e67ad900ae5e4fe7696c7b3f753c (patch)
tree2c95978b661d39e633b446617354981a9477cb2c /src/afl-showmap.c
parente6685436d8c8e5a346b3aa10b9d28098c1ca2dd7 (diff)
downloadafl++-312732bdbe50e67ad900ae5e4fe7696c7b3f753c.tar.gz
more portability for (solaris-based OpenIndiana)
Diffstat (limited to 'src/afl-showmap.c')
-rw-r--r--src/afl-showmap.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/afl-showmap.c b/src/afl-showmap.c
index 9c146771..1686a750 100644
--- a/src/afl-showmap.c
+++ b/src/afl-showmap.c
@@ -925,6 +925,9 @@ int main(int argc, char** argv) {
     struct dirent* dir_ent;
     int            done = 0;
     u8             infile[4096], outfile[4096];
+#if !defined(DT_REG)
+    struct stat    statbuf;
+#endif
 
     dev_null_fd = open("/dev/null", O_RDWR);
     if (dev_null_fd < 0) PFATAL("Unable to open /dev/null");
@@ -970,9 +973,18 @@ int main(int argc, char** argv) {
 
       if (dir_ent->d_name[0] == '.')
         continue;  // skip anything that starts with '.'
+
+#if defined(DT_REG) /* Posix and Solaris do not know d_type and DT_REG */
       if (dir_ent->d_type != DT_REG) continue;  // only regular files
+#endif
 
       snprintf(infile, sizeof(infile), "%s/%s", in_dir, dir_ent->d_name);
+
+#if !defined(DT_REG) /* use stat() */
+      if (-1 == stat(infile, &statbuf)
+          || !S_ISREG(statbuf.st_mode)) continue;
+#endif
+
       snprintf(outfile, sizeof(outfile), "%s/%s", out_file, dir_ent->d_name);
 
       if (read_file(infile)) {