Loading...
--- /dev/null
+++ Libc/Libc-391.5.18/db/hash/FreeBSD/ndbm.c.patch
@@ -0,0 +1,60 @@
+--- ndbm.c.orig 2004-10-28 23:25:13.000000000 -0700
++++ ndbm.c 2004-10-28 23:25:42.000000000 -0700
+@@ -51,6 +51,7 @@
+ #include <string.h>
+ #include <errno.h>
+
++#include <db.h>
+ #include <ndbm.h>
+ #include "hash.h"
+
+@@ -62,7 +63,8 @@
+ extern DBM *
+ dbm_open(file, flags, mode)
+ const char *file;
+- int flags, mode;
++ int flags;
++ mode_t mode;
+ {
+ HASHINFO info;
+ char path[MAXPATHLEN];
+@@ -128,10 +130,14 @@
+ int status;
+ datum retkey;
+ DBT dbtretkey, dbtretdata;
++ HTAB *htab = (HTAB *)(db->internal);
+
+ status = (db->seq)(db, &dbtretkey, &dbtretdata, R_FIRST);
+- if (status)
++ if (status) {
+ dbtretkey.data = NULL;
++ htab->nextkey_eof = 1;
++ } else
++ htab->nextkey_eof = 0;
+ retkey.dptr = dbtretkey.data;
+ retkey.dsize = dbtretkey.size;
+ return (retkey);
+@@ -146,13 +152,20 @@
+ dbm_nextkey(db)
+ DBM *db;
+ {
+- int status;
++ int status = 1;
+ datum retkey;
+ DBT dbtretkey, dbtretdata;
++ HTAB *htab = (HTAB *)(db->internal);
+
+- status = (db->seq)(db, &dbtretkey, &dbtretdata, R_NEXT);
+- if (status)
++ if (htab->nextkey_eof)
+ dbtretkey.data = NULL;
++ else {
++ status = (db->seq)(db, &dbtretkey, &dbtretdata, R_NEXT);
++ if (status) {
++ dbtretkey.data = NULL;
++ htab->nextkey_eof = 1;
++ }
++ }
+ retkey.dptr = dbtretkey.data;
+ retkey.dsize = dbtretkey.size;
+ return (retkey);