hash can actually read version 1 as well as version 2, the on-disk
[unix-history] / usr / src / lib / libc / db / hash / hash.c
index a8758cb..0dd3267 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)hash.c     8.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)hash.c     8.4 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/param.h>
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/param.h>
@@ -127,7 +127,9 @@ __hash_open(file, flags, mode, info, dflags)
                /* Verify file type, versions and hash function */
                if (hashp->MAGIC != HASHMAGIC)
                        RETURN_ERROR(EFTYPE, error1);
                /* Verify file type, versions and hash function */
                if (hashp->MAGIC != HASHMAGIC)
                        RETURN_ERROR(EFTYPE, error1);
-               if (hashp->VERSION != HASHVERSION)
+#define        OLDHASHVERSION  1
+               if (hashp->VERSION != HASHVERSION &&
+                   hashp->VERSION != OLDHASHVERSION)
                        RETURN_ERROR(EFTYPE, error1);
                if (hashp->hash(CHARKEY, sizeof(CHARKEY)) != hashp->H_CHARKEY)
                        RETURN_ERROR(EFTYPE, error1);
                        RETURN_ERROR(EFTYPE, error1);
                if (hashp->hash(CHARKEY, sizeof(CHARKEY)) != hashp->H_CHARKEY)
                        RETURN_ERROR(EFTYPE, error1);