void-packages/srcpkgs/pev/patches/0010-fix-readdir-bug.patch

34 lines
908 B
Diff
Raw Normal View History

From 9173ec91ab3c82833ad2ac691e7421607c5edbc3 Mon Sep 17 00:00:00 2001
From: root <root@localhost.localdomain>
Date: Fri, 11 Aug 2017 18:13:07 +0800
Subject: [PATCH 10/12] fix readdir bug
---
src/plugins.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git src/plugins.c src/plugins.c
index 7488043..3885e01 100644
--- src/plugins.c
+++ src/plugins.c
@@ -159,10 +159,16 @@ int plugins_load_all_from_directory(const char *path) {
// MORE: http://womble.decadent.org.uk/readdir_r-advisory.html
// NOTE: readdir is not thread-safe.
while ((dir_entry = readdir(dir)) != NULL) {
+
switch (dir_entry->d_type) {
default: // Unhandled
break;
+
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+ case DT_UNKNOWN:
+#else
case DT_REG: // Regular file
+#endif
{
const char *filename = dir_entry->d_name;
--
2.26.2.672.g232c24e857