Index: sdbm.c
===================================================================
RCS file: /var/cvs-pub/sdbm/sdbm.c,v
retrieving revision 1.1.1.1
diff -u -u -r1.1.1.1 sdbm.c
--- sdbm.c	1999/08/04 15:49:34	1.1.1.1
+++ sdbm.c	1999/08/07 14:59:12
@@ -8,7 +8,7 @@
  */
 
 #ifndef lint
-static char rcsid[] = "$Id: sdbm.c,v 1.1.1.1 1999/08/04 15:49:34 uwe Exp $";
+static char rcsid[] = "$Id: sdbm.c,v 1.2 1999/08/04 22:14:11 uwe Exp $";
 #endif
 
 #include "config.h"
@@ -453,9 +453,12 @@
 	dirb = c / DBLKSIZ;
 
 	if (dirb != db->dirbno) {
+		int got;
 		if (lseek(db->dirf, OFF_DIR(dirb), SEEK_SET) < 0
-		    || read(db->dirf, db->dirbuf, DBLKSIZ) < 0)
+		    || (got=read(db->dirf, db->dirbuf, DBLKSIZ)) < 0)
 			return 0;
+		if (got==0) 
+			memset(db->dirbuf,0,DBLKSIZ);
 		db->dirbno = dirb;
 
 		debug(("dir read: %d\n", dirb));
@@ -476,9 +479,12 @@
 	dirb = c / DBLKSIZ;
 
 	if (dirb != db->dirbno) {
+		int got;
 		if (lseek(db->dirf, OFF_DIR(dirb), SEEK_SET) < 0
-		    || read(db->dirf, db->dirbuf, DBLKSIZ) < 0)
+		    || (got=read(db->dirf, db->dirbuf, DBLKSIZ)) < 0)
 			return 0;
+		if (got==0) 
+			memset(db->dirbuf,0,DBLKSIZ);
 		db->dirbno = dirb;
 
 		debug(("dir read: %d\n", dirb));
@@ -486,8 +492,13 @@
 
 	db->dirbuf[c % DBLKSIZ] |= (1 << dbit % BYTESIZ);
 
+#if 0
 	if (dbit >= db->maxbno)
 		db->maxbno += DBLKSIZ * BYTESIZ;
+#else
+	if (OFF_DIR((dirb+1))*BYTESIZ > db->maxbno) 
+		db->maxbno=OFF_DIR((dirb+1))*BYTESIZ;
+#endif
 
 	if (lseek(db->dirf, OFF_DIR(dirb), SEEK_SET) < 0
 	    || write(db->dirf, db->dirbuf, DBLKSIZ) < 0)
