[hackers] [9base] Fix building on OpenBSD 5.5 || sin

From: <git_AT_suckless.org>
Date: Fri, 07 Mar 2014 16:04:31 +0100

commit 27d866c6ab4a2349a23cb21dada9a1136f76bfc0
Author: sin <sin_AT_2f30.org>
Date: Mon Mar 3 13:57:30 2014 +0000

    Fix building on OpenBSD 5.5
    
    getdirentries() has been removed and instead we should use
    getdents().

diff --git a/lib9/dirread.c b/lib9/dirread.c
index 99d5597..f114195 100644
--- a/lib9/dirread.c
+++ b/lib9/dirread.c
_AT_@ -28,12 +28,21 @@ mygetdents(int fd, struct dirent *buf, int n)
         return getdirentries(fd, (void*)buf, n, &off);
 }
 #elif defined(__OpenBSD__)
+#include <sys/param.h>
+# if OpenBSD < 201405 /* for OpenBSD 5.4 and earlier */
 static int
 mygetdents(int fd, struct dirent *buf, int n)
 {
         off_t off;
         return getdirentries(fd, (void*)buf, n, &off);
 }
+# else
+static int
+mygetdents(int fd, struct dirent *buf, int n)
+{
+ return getdents(fd, (void*)buf, n);
+}
+# endif
 #elif defined(__sun__) || defined(__NetBSD__)
 static int
 mygetdents(int fd, struct dirent *buf, int n)
Received on Fri Mar 07 2014 - 16:04:31 CET

This archive was generated by hypermail 2.3.0 : Fri Mar 07 2014 - 16:12:18 CET