aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/db/hash/hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/db/hash/hash.c')
-rw-r--r--lib/libc/db/hash/hash.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/libc/db/hash/hash.c b/lib/libc/db/hash/hash.c
index aa2e42856ebe..e9b25831d20e 100644
--- a/lib/libc/db/hash/hash.c
+++ b/lib/libc/db/hash/hash.c
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)hash.c 8.1 (Berkeley) 6/6/93";
+static char sccsid[] = "@(#)hash.c 8.4 (Berkeley) 10/12/93";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -93,9 +93,9 @@ long hash_accesses, hash_collisions, hash_expansions, hash_overflows;
/* OPEN/CLOSE */
extern DB *
-__hash_open(file, flags, mode, info)
+__hash_open(file, flags, mode, info, dflags)
const char *file;
- int flags, mode;
+ int flags, mode, dflags;
const HASHINFO *info; /* Special directives for create */
{
HTAB *hashp;
@@ -111,13 +111,14 @@ __hash_open(file, flags, mode, info)
if (!(hashp = calloc(1, sizeof(HTAB))))
return (NULL);
hashp->fp = -1;
+
/*
- * Select flags relevant to us. Even if user wants write only, we need
- * to be able to read the actual file, so we need to open it read/write.
- * But, the field in the hashp structure needs to be accurate so that
+ * Even if user wants write only, we need to be able to read
+ * the actual file, so we need to open it read/write. But, the
+ * field in the hashp structure needs to be accurate so that
* we can check accesses.
*/
- hashp->flags = flags = flags & __USE_OPEN_FLAGS;
+ hashp->flags = flags;
new_table = 0;
if (!file || (flags & O_TRUNC) ||
@@ -152,7 +153,9 @@ __hash_open(file, flags, mode, info)
/* 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);
@@ -865,7 +868,7 @@ hash_realloc(p_ptr, oldsize, newsize)
if (p = malloc(newsize)) {
memmove(p, *p_ptr, oldsize);
- memset(p + oldsize, 0, newsize - oldsize);
+ memset((char *)p + oldsize, 0, newsize - oldsize);
free(*p_ptr);
*p_ptr = p;
}