summaryrefslogtreecommitdiff
path: root/sysutils/9base/patches/patch-av
diff options
context:
space:
mode:
Diffstat (limited to 'sysutils/9base/patches/patch-av')
-rw-r--r--sysutils/9base/patches/patch-av60
1 files changed, 60 insertions, 0 deletions
diff --git a/sysutils/9base/patches/patch-av b/sysutils/9base/patches/patch-av
new file mode 100644
index 00000000000..73820465d7f
--- /dev/null
+++ b/sysutils/9base/patches/patch-av
@@ -0,0 +1,60 @@
+$NetBSD: patch-av,v 1.1 2006/06/21 19:34:45 joerg Exp $
+
+--- lib9/dirread.c.orig 2006-06-21 17:11:56.000000000 +0000
++++ lib9/dirread.c
+@@ -18,7 +18,7 @@ mygetdents(int fd, struct dirent *buf, i
+ nn = getdirentries(fd, (void*)buf, n, &off);
+ return nn;
+ }
+-#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
++#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
+ static int
+ mygetdents(int fd, struct dirent *buf, int n)
+ {
+@@ -44,14 +44,22 @@ countde(char *p, int n)
+ m = 0;
+ while(p < e){
+ de = (struct dirent*)p;
++#if defined(__DragonFly__)
++ if (p + _DIRENT_DIRSIZ(de) > e)
++#else
+ if(de->d_reclen <= 4+2+2+1 || p+de->d_reclen > e)
++#endif
+ break;
+ if(de->d_name[0]=='.' && de->d_name[1]==0)
+ de->d_name[0] = 0;
+ else if(de->d_name[0]=='.' && de->d_name[1]=='.' && de->d_name[2]==0)
+ de->d_name[0] = 0;
+ m++;
++#if defined(__DragonFly__)
++ p += _DIRENT_DIRSIZ(de);
++#else
+ p += de->d_reclen;
++#endif
+ }
+ return m;
+ }
+@@ -91,7 +99,11 @@ dirpackage(int fd, char *buf, int n, Dir
+ stat(de->d_name, &st);
+ nstr += _p9dir(&lst, &st, de->d_name, nil, nil, nil);
+ }
++#if defined(__DragonFly__)
++ p += _DIRENT_DIRSIZ(de);
++#else
+ p += de->d_reclen;
++#endif
+ }
+
+ d = malloc(sizeof(Dir)*n+nstr);
+@@ -113,7 +125,11 @@ dirpackage(int fd, char *buf, int n, Dir
+ stat(de->d_name, &st);
+ _p9dir(&lst, &st, de->d_name, &d[m++], &str, estr);
+ }
++#if defined(__DragonFly__)
++ p += _DIRENT_DIRSIZ(de);
++#else
+ p += de->d_reclen;
++#endif
+ }
+
+ fchdir(oldwd);